DemoFile 0.4.1

There is a newer version of this package available.
See the version list below for details.
dotnet add package DemoFile --version 0.4.1
                    
NuGet\Install-Package DemoFile -Version 0.4.1
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="DemoFile" Version="0.4.1" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="DemoFile" Version="0.4.1" />
                    
Directory.Packages.props
<PackageReference Include="DemoFile" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add DemoFile --version 0.4.1
                    
#r "nuget: DemoFile, 0.4.1"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#addin nuget:?package=DemoFile&version=0.4.1
                    
Install as a Cake Addin
#tool nuget:?package=DemoFile&version=0.4.1
                    
Install as a Cake Tool

DemoFile.Net NuGet Build status

DemoFile.Net is a blazing fast demo parser library for Counter-Strike 2, written in C#. It is cross platform, and can be used from Windows, Mac or Linux.

Screenshot of DemoFile.Net

Easy discoverability of available data through your IDE's inbuilt autocompletion:

alternate text is missing from this package README image alternate text is missing from this package README image
alternate text is missing from this package README image alternate text is missing from this package README image

Features

Feature Availability
CSTV / GOTV demos ✅ Full support
POV demos ➖ Support planned
Game events (e.g. player_death) ✅ Full support
Entity updates (player positions, grenades, etc.) ✅ Full support

Examples

Note: This library is still under heavy development and the API is likely to change significantly before v1.0

using DemoFile;

internal class Program
{
    public static async Task Main(string[] args)
    {
        var path = args.SingleOrDefault() ?? throw new Exception("Expected a single argument: <path to .dem>");

        var demo = new DemoParser();
        demo.Source1GameEvents.PlayerDeath += e =>
        {
            Console.WriteLine($"{e.Attacker?.PlayerName} [{e.Weapon}] {e.Player?.PlayerName}");
        };

        await demo.Start(File.OpenRead(path));

        Console.WriteLine("\nFinished!");
    }
}

See also the examples/ folder.

Benchmarks

On an M1 MacBook Pro, DemoFile.Net can read a full competitive game (just under 1 hour of game time) in 1.5 seconds. This includes parsing all entity data (player positions, velocities, weapon tracking, grenades, etc).

Method Runtime Mean Error StdDev
ParseDemo .NET 8.0 1.501 s 0.0047 s 0.0042 s

Author and acknowledgements

DemoFile.Net is developed by Saul Rennison. The development of this library would not have been possible without demoparser by LaihoE and Manta by Dotabuff, the latter of which depends on the efforts of a number of people:

A modified version of Source2Gen by neverlosecc is used to statically generate the game schema classes and enums.

See ACKNOWLEDGEMENTS for license information.

Product Compatible and additional computed target framework versions.
.NET net7.0 is compatible.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (2)

Showing the top 2 NuGet packages that depend on DemoFile:

Package Downloads
DemoFile.Game.Cs

DemoFile.Game.Cs is a blazing fast Counter-Strike 2 demo parser library.

DemoFile.Game.Deadlock

DemoFile.Game.Deadlock is a blazing fast demo parser for Valve's Deadlock.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
0.30.1 191 6/1/2025
0.29.1 449 3/1/2025
0.28.1 203 1/31/2025
0.27.1 954 11/2/2024
0.26.1 156 10/29/2024
0.25.1 345 10/12/2024
0.24.1 163 10/7/2024
0.23.1 185 9/27/2024
0.22.3 158 9/23/2024
0.22.1 156 9/22/2024
0.21.1 199 9/14/2024
0.20.1 186 9/7/2024
0.19.1 156 9/7/2024
0.18.1 806 8/16/2024
0.17.1 165 8/11/2024
0.16.3 159 8/2/2024
0.16.2 102 8/1/2024
0.16.1 107 8/1/2024
0.15.1 690 6/1/2024
0.14.1 205 5/26/2024
0.13.1 238 4/30/2024
0.12.2 175 4/12/2024
0.12.1 430 2/29/2024
0.11.1 244 2/19/2024
0.10.1 143 2/17/2024
0.9.1 182 2/9/2024
0.8.1 236 12/30/2023
0.6.1 196 12/23/2023
0.5.1 395 12/19/2023
0.4.1 198 12/9/2023
0.3.6 199 11/25/2023
0.3.5 149 11/25/2023
0.3.4 152 11/25/2023
0.3.1 156 11/25/2023
0.2.9 181 11/12/2023
0.2.8 146 11/12/2023
0.2.7 157 11/12/2023
0.2.6 135 11/11/2023
0.2.5 134 11/11/2023
0.2.4 142 11/11/2023
0.2.3 140 11/8/2023
0.2.2 140 11/5/2023
0.2.1 203 10/29/2023
0.1.11 175 10/25/2023
0.1.10 176 10/22/2023
0.1.9 160 10/19/2023
0.1.7 174 10/12/2023