Closed in0finite closed 11 months ago
I don't believe this event is recorded in CS2 demos.
You'd have to read the whole file, keeping track of the last demo tick. Divide the ticks by 64 and you have the number seconds elapsed through the recording.
If you're really looking for speed, you can null out the PacketEntities
parsing, which is the bulk of the parsing time. For example:
var demo = new DemoParser();
demo.PacketEvents.SvcPacketEntities = null;
await demo.Start(File.OpenRead(path));
var duration = demo.CurrentDemoTick.Value / 64.0f;
Console.WriteLine($"Demo is {duration:N1} secs long");
Actually, I heard that CDemoFileInfo
does exist, and it's located after DemStop
command. Apparently, there is an offset to it in CDemoFileHeader
. It doesn't make much sense ...
You're right. PR for this here: https://github.com/saul/demofile-net/pull/31
Research
Description
I was trying to get total duration (total tick count) of demo file, and found that
CDemoFileInfo
demo command has this info.However, this command is never invoked. I am not sure if this is a bug in the library, or the command is simply not in demo file.
Anyway, is there any way to find out total duration of the match (without parsing entire file) ?
Code to reproduce
Affected demos
No response