Skip to content
This repository was archived by the owner on Sep 22, 2021. It is now read-only.

Commit 4afcbc1

Browse files
committed
HeaderCorrupted event added
1 parent cd40823 commit 4afcbc1

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

DemoInfo/DemoParser.cs

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,11 @@ public class DemoParser : IDisposable
3434
/// </summary>
3535
public event EventHandler<HeaderParsedEventArgs> HeaderParsed;
3636

37+
/// <summary>
38+
/// Raised when header data is corrupted and timings are zero and null.
39+
/// </summary>
40+
public event EventHandler<HeaderParsedEventArgs> HeaderCorrupted;
41+
3742
/// <summary>
3843
/// Occurs when the match started, so when the "begin_new_match"-GameEvent is dropped.
3944
/// This usually right before the freezetime of the 1st round. Be careful, since the players
@@ -514,6 +519,15 @@ public void ParseHeader()
514519

515520
Header = header;
516521

522+
if (header.PlaybackTime == 0)
523+
{
524+
Console.WriteLine("WARNING: The header for this demo file is corrupted. TickRate, TickTime, ParsingProgress, CurrentTime will be 0 for the first 50 ticks. PlaybackFrames, PlaybackTicks, PlaybackTime will always be 0. HeaderCorrupted event triggered.");
525+
526+
if (HeaderCorrupted != null)
527+
{
528+
HeaderCorrupted(this, new HeaderParsedEventArgs(Header));
529+
}
530+
}
517531

518532
if (HeaderParsed != null)
519533
HeaderParsed(this, new HeaderParsedEventArgs(Header));
@@ -1394,6 +1408,7 @@ public void Dispose ()
13941408
this.FireNadeStarted = null;
13951409
this.FlashNadeExploded = null;
13961410
this.HeaderParsed = null;
1411+
this.HeaderCorrupted = null;
13971412
this.MatchStarted = null;
13981413
this.NadeReachedTarget = null;
13991414
this.PlayerKilled = null;

0 commit comments

Comments
 (0)