DemoFile 0.30.1
dotnet add package DemoFile --version 0.30.1
NuGet\Install-Package DemoFile -Version 0.30.1
<PackageReference Include="DemoFile" Version="0.30.1" />
<PackageVersion Include="DemoFile" Version="0.30.1" />
<PackageReference Include="DemoFile" />
paket add DemoFile --version 0.30.1
#r "nuget: DemoFile, 0.30.1"
#addin nuget:?package=DemoFile&version=0.30.1
#tool nuget:?package=DemoFile&version=0.30.1
DemoFile.Net

DemoFile.Net is a blazing fast demo parser library for Source 2 games, written in C#. It is cross-platform, and can be used on Windows, Mac or Linux. This parser currently supports:
Game | NuGet package | Getting started |
---|---|---|
Counter-Strike 2 | ✅ DemoFile.Game.Cs | new CsDemoParser() |
Deadlock | ✅ DemoFile.Game.Deadlock | new DeadlockDemoParser() |
DemoFile
is the base, core library and does not provide support for parsing any specific game.
Add a reference to one of the DemoFile.Game.*
packages instead.
Easy discoverability of available data through your IDE's inbuilt autocompletion:
![]() |
![]() |
---|---|
![]() |
![]() |
Features
Feature | Availability |
---|---|
CSTV / GOTV demos | ✅ Full support |
POV demos | ✅ Full support |
HTTP broadcasts | ✅ Full support |
Game events (e.g. player_death ) |
✅ Full support |
Entity updates (player positions, grenades, etc.) | ✅ Full support |
Seeking forwards/backwards through the demo | ✅ Full support |
Getting Started
Installation
Add the appropriate NuGet package to your project:
# For Counter-Strike 2
dotnet add package DemoFile.Game.Cs
# For Deadlock
dotnet add package DemoFile.Game.Deadlock
Basic Usage
Here's a simple example that prints kill feed information from a CS2 demo:
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 CsDemoParser();
demo.Source1GameEvents.PlayerDeath += e =>
{
Console.WriteLine($"{e.Attacker?.PlayerName} [{e.Weapon}] {e.Player?.PlayerName}");
};
var reader = DemoFileReader.Create(demo, File.OpenRead(path));
await reader.ReadAllAsync();
Console.WriteLine("\nFinished!");
}
}
Advanced Examples
Tracking Player Positions
You can track player positions and other entity data throughout the demo:
var demo = new CsDemoParser();
// Subscribe to tick events to get data at specific points in time
demo.TickEnd += (_, tick) =>
{
// Get all active players
foreach (var player in demo.Entities.Players)
{
if (player.Pawn is { } pawn)
{
Console.WriteLine($"Player {player.PlayerName} is at position {pawn.CBodyComponent?.Position}");
}
}
};
var reader = DemoFileReader.Create(demo, File.OpenRead(demoPath));
await reader.ReadAllAsync();
Working with Game Events
DemoFile.Net provides strongly-typed access to game events:
var demo = new CsDemoParser();
// Track round wins
demo.Source1GameEvents.RoundEnd += e =>
{
Console.WriteLine($"Round ended. Winner: {e.Winner}. Reason: {e.Reason}");
};
// Track bomb events
demo.Source1GameEvents.BombPlanted += e =>
{
Console.WriteLine($"Bomb planted by {e.Player?.PlayerName} at site {e.Site}");
};
demo.Source1GameEvents.BombDefused += e =>
{
Console.WriteLine($"Bomb defused by {e.Player?.PlayerName}");
};
var reader = DemoFileReader.Create(demo, File.OpenRead(demoPath));
await reader.ReadAllAsync();
Parallel Processing for Maximum Performance
For maximum performance, parse demos in parallel using multiple CPU cores:
var demo = new CsDemoParser();
// Set up your event handlers...
var reader = DemoFileReader.Create(demo, File.OpenRead(demoPath));
await reader.ReadAllParallelAsync(); // Uses all available CPU cores
HTTP Broadcast Support
DemoFile.Net can parse live HTTP broadcasts:
var demo = new CsDemoParser();
// Set up your event handlers...
var reader = HttpBroadcastReader.Create(demo, "http://localhost:8080/broadcast");
await reader.ReadAllAsync();
See the examples/ folder for more complete examples:
- Basic - Simple demo parsing
- MultiThreaded - Parallel processing for maximum performance
- PlayerPositions - Tracking player positions and movements
- HttpBroadcast - Parsing live HTTP broadcasts
Benchmarks
On an M1 MacBook Pro, DemoFile.Net can read a full competitive game (just under 1 hour of game time) in 1.3 seconds.
When parsing across multiple threads, using the ReadAllParallelAsync
method, this drops to nearly 500 milliseconds.
This includes parsing all entity data (player positions, velocities, weapon tracking, grenades, etc).
Method | Mean | Error | StdDev | Allocated |
---|---|---|---|---|
ParseDemo | 1,294.6 ms | 3.68 ms | 2.88 ms | 491.48 MB |
ParseDemoParallel | 540.1 ms | 23.99 ms | 22.44 ms | 600.67 MB |
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:
- Michael Fellinger built Dotabuff's Source 1 parser yasha.
- Robin Dietrich built the C++ parser Alice.
- Martin Schrodt built the Java parser clarity.
- Drew Schleck built an original C++ parser edith.
A modified version of Source2Gen by neverlosecc is used to statically generate the game schema classes and enums.
See ACKNOWLEDGEMENTS for license information.
Product | Versions 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. |
-
net7.0
- Google.Protobuf (>= 3.22.1)
- NerdBank.GitVersioning (>= 3.6.133)
- protobuf-net (>= 3.2.16)
- Snappier (>= 1.1.1)
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 | 148 | 6/1/2025 |
0.29.1 | 406 | 3/1/2025 |
0.28.1 | 197 | 1/31/2025 |
0.27.1 | 886 | 11/2/2024 |
0.26.1 | 150 | 10/29/2024 |
0.25.1 | 339 | 10/12/2024 |
0.24.1 | 155 | 10/7/2024 |
0.23.1 | 178 | 9/27/2024 |
0.22.3 | 151 | 9/23/2024 |
0.22.1 | 150 | 9/22/2024 |
0.21.1 | 192 | 9/14/2024 |
0.20.1 | 181 | 9/7/2024 |
0.19.1 | 151 | 9/7/2024 |
0.18.1 | 794 | 8/16/2024 |
0.17.1 | 160 | 8/11/2024 |
0.16.3 | 151 | 8/2/2024 |
0.16.2 | 97 | 8/1/2024 |
0.16.1 | 101 | 8/1/2024 |
0.15.1 | 647 | 6/1/2024 |
0.14.1 | 199 | 5/26/2024 |
0.13.1 | 230 | 4/30/2024 |
0.12.2 | 169 | 4/12/2024 |
0.12.1 | 422 | 2/29/2024 |
0.11.1 | 234 | 2/19/2024 |
0.10.1 | 136 | 2/17/2024 |
0.9.1 | 172 | 2/9/2024 |
0.8.1 | 231 | 12/30/2023 |
0.6.1 | 192 | 12/23/2023 |
0.5.1 | 387 | 12/19/2023 |
0.4.1 | 194 | 12/9/2023 |
0.3.6 | 194 | 11/25/2023 |
0.3.5 | 147 | 11/25/2023 |
0.3.4 | 148 | 11/25/2023 |
0.3.1 | 153 | 11/25/2023 |
0.2.9 | 179 | 11/12/2023 |
0.2.8 | 143 | 11/12/2023 |
0.2.7 | 155 | 11/12/2023 |
0.2.6 | 133 | 11/11/2023 |
0.2.5 | 130 | 11/11/2023 |
0.2.4 | 140 | 11/11/2023 |
0.2.3 | 137 | 11/8/2023 |
0.2.2 | 138 | 11/5/2023 |
0.2.1 | 197 | 10/29/2023 |
0.1.11 | 168 | 10/25/2023 |
0.1.10 | 169 | 10/22/2023 |
0.1.9 | 151 | 10/19/2023 |
0.1.7 | 167 | 10/12/2023 |