StatsHelix / demoinfo

A library to analyze CS:GO demos in C#
MIT License
321 stars 78 forks source link

Does not parsing all players properly #150

Open gdhsnlvr opened 6 years ago

gdhsnlvr commented 6 years ago

Lib does not parsing some players and event related to this players have null in player field. examples: https://www.hltv.org/matches/2320066/sk-vs-astralis-iem-katowice-2018 map 2 (de_mirage). https://www.hltv.org/matches/2320074/renegades-vs-cloud9-iem-katowice-2018 map 3 (de_train). parser.PlayingParticipants have 9 players, PlayerKilledEventArgs have null in fields Killer/Victim/Assister when event related to missing player. (version is last stable realise 1.2.0)

InspektorLulz commented 5 years ago

Hi I found that the library doesnt parse all entries in a Stringtable Packet. Just delete line 83 and 84 in Namespace: DemoInfo.DP.Handler Class: CreateStringTableUserInfoHandler .

if (userdata.Length == 0) break;

That at least solved my issue with players not beeing parsed.

master117 commented 5 years ago

Deleting that will lead to unwated behavior, change it to:

if (userdata.Length == 0)
  continue;

instead.

Edit:

I just checked, it is already

if (userdata.Length == 0)
  continue;

where did you see:

if (userdata.Length == 0)
  break;

?

master117 commented 5 years ago

I just removed

if (userdata.Length == 0)
  continue;

as you suggested. This leads to exceptions in Helper.cs:

        public static long ReadInt64SwapEndian(this BinaryReader reader)
        {
            return BitConverter.ToInt64(reader.ReadBytes(8).Reverse().ToArray(), 0);
        }

steaming from:

internal PlayerInfo(BinaryReader reader)
InspektorLulz commented 5 years ago

In the stable release 1.2.0 from November 2015 (you can download the zip) there is a break instead of continue. You are right, it should be continue. I didn't get the exception though.