public void Parse(IBitStream bitstream, DemoParser parser) { while (!bitstream.ChunkFinished) { var desc = bitstream.ReadProtobufVarInt(); var wireType = desc & 7; var fieldnum = desc >> 3; if (wireType == 2 && fieldnum == 1) { Name = bitstream.ReadProtobufString(); } else if (wireType == 2 && fieldnum == 2) { Value = bitstream.ReadProtobufString(); } else if (wireType == 0 && fieldnum == 3) { DictionaryName = (uint)bitstream.ReadProtobufVarInt(); } else { throw new InvalidDataException(); } } Raise(parser); }
public void Parse(IBitStream bitstream) { while (!bitstream.ChunkFinished) { var desc = bitstream.ReadProtobufVarInt(); var wireType = desc & 7; var fieldnum = desc >> 3; if (wireType == 2) { if (fieldnum == 2) { VarName = bitstream.ReadProtobufString(); } else if (fieldnum == 5) { DtName = bitstream.ReadProtobufString(); } else throw new InvalidDataException("yes I know we should drop this but we" + "probably want to know that they added a new big field"); } else if (wireType == 0) { var val = bitstream.ReadProtobufVarInt(); switch (fieldnum) { case 1: Type = val; break; case 3: Flags = val; break; case 4: Priority = val; break; case 6: NumElements = val; break; case 9: NumBits = val; break; default: // silently drop break; } } else if (wireType == 5) { var val = bitstream.ReadFloat(); switch (fieldnum) { case 7: LowValue = val; break; case 8: HighValue = val; break; default: // silently drop break; } } else throw new InvalidDataException(); } }
public void Parse(IBitStream bitstream) { var keys = new List <Key>(); while (!bitstream.ChunkFinished) { var desc = bitstream.ReadProtobufVarInt(); var wireType = desc & 7; var fieldnum = desc >> 3; if (wireType == 0 && fieldnum == 1) { EventId = bitstream.ReadProtobufVarInt(); } else if (wireType == 2 && fieldnum == 2) { Name = bitstream.ReadProtobufString(); } else if (wireType == 2 && fieldnum == 3) { var length = bitstream.ReadProtobufVarInt(); bitstream.BeginChunk(length * 8); var key = new Key(); key.Parse(bitstream); keys.Add(key); bitstream.EndChunk(); } else { throw new InvalidDataException(); } } Keys = keys.ToArray(); }
public void Parse(IBitStream bitstream, DemoParser parser) { while (!bitstream.ChunkFinished) { var desc = bitstream.ReadProtobufVarInt(); var wireType = desc & 7; var fieldnum = desc >> 3; if (wireType == 0 && fieldnum == 1) { EntityIndex = bitstream.ReadProtobufVarInt(); } else if (wireType == 2 && fieldnum == 2) { Text = bitstream.ReadProtobufString(); } else if (wireType == 0 && fieldnum == 3) { _chat = bitstream.ReadProtobufVarInt(); } else if (wireType == 0 && fieldnum == 4) { _textAllChat = bitstream.ReadProtobufVarInt(); } else { throw new InvalidDataException(); } } Raise(parser); }
public IEnumerable <SendProp> Parse(IBitStream bitstream) { var sendprops = new List <SendProp>(); while (!bitstream.ChunkFinished) { var desc = bitstream.ReadProtobufVarInt(); var wireType = desc & 7; var fieldnum = desc >> 3; if (wireType == 2) { if (fieldnum == 2) { NetTableName = bitstream.ReadProtobufString(); } else if (fieldnum == 4) { // Props are special. // We'll simply hope that gaben is nice and sends // props last, just like he should. var len = bitstream.ReadProtobufVarInt(); bitstream.BeginChunk(len * 8); var sendprop = new SendProp(); sendprop.Parse(bitstream); sendprops.Add(sendprop); bitstream.EndChunk(); } else { throw new InvalidDataException("yes I know we should drop this" + "but we probably want to know that they added a new big field"); } } else if (wireType == 0) { var val = bitstream.ReadProtobufVarInt(); switch (fieldnum) { case 1: _IsEnd = val; break; case 3: _NeedsDecoder = val; break; } } else { throw new InvalidDataException(); } } return(sendprops); }
public void Parse(IBitStream bitstream, DemoParser parser) { while (!bitstream.ChunkFinished) { var desc = bitstream.ReadProtobufVarInt(); var wireType = desc & 7; var fieldnum = desc >> 3; if (wireType == 2) { if (fieldnum == 1) { Name = bitstream.ReadProtobufString(); continue; } else if (fieldnum == 8) { // String data is special. // We'll simply hope that gaben is nice and sends // string_data last, just like he should. var len = bitstream.ReadProtobufVarInt(); bitstream.BeginChunk(len * 8); DemoInfo.DP.Handler.CreateStringTableUserInfoHandler.Apply(this, bitstream, parser); bitstream.EndChunk(); if (!bitstream.ChunkFinished) throw new NotImplementedException("Lord Gaben wasn't nice to us :/"); break; } else throw new InvalidDataException("yes I know we should drop this but we" + "probably want to know that they added a new big field"); } if (wireType != 0) throw new InvalidDataException(); var val = bitstream.ReadProtobufVarInt(); switch (fieldnum) { case 2: MaxEntries = val; break; case 3: NumEntries = val; break; case 4: _UserDataFixedSize = val; break; case 5: UserDataSize = val; break; case 6: UserDataSizeBits = val; break; case 7: Flags = val; break; default: // silently drop break; } } }
public void Parse(IBitStream bitstream) { while (!bitstream.ChunkFinished) { var desc = bitstream.ReadProtobufVarInt(); var wireType = desc & 7; var fieldnum = desc >> 3; if ((wireType == 0) && (fieldnum == 1)) { Type = bitstream.ReadProtobufVarInt(); } else if ((wireType == 2) && (fieldnum == 2)) { Name = bitstream.ReadProtobufString(); } else throw new InvalidDataException(); } }
public void Parse(IBitStream bitstream, DemoParser parser) { Params = new List <string>(); while (!bitstream.ChunkFinished) { var desc = bitstream.ReadProtobufVarInt(); var wireType = desc & 7; var fieldnum = desc >> 3; if (wireType == 0 && fieldnum == 1) { EntIdx = bitstream.ReadProtobufVarInt(); } else if (wireType == 0 && fieldnum == 2) { _chat = bitstream.ReadProtobufVarInt(); } else if (wireType == 2 && fieldnum == 3) { MsgName = bitstream.ReadProtobufString(); } else if (wireType == 0 && fieldnum == 5) { _textAllChat = bitstream.ReadProtobufVarInt(); } else if (wireType == 2 && fieldnum == 4) { Params.Add(bitstream.ReadProtobufString()); } else { throw new InvalidDataException(); } } Raise(parser); }
public void Parse(IBitStream bitstream) { while (!bitstream.ChunkFinished) { var desc = bitstream.ReadProtobufVarInt(); var wireType = desc & 7; var fieldnum = desc >> 3; if (wireType == 0 && fieldnum == 1) { Type = bitstream.ReadProtobufVarInt(); } else if (wireType == 2 && fieldnum == 2) { Name = bitstream.ReadProtobufString(); } else { throw new InvalidDataException(); } } }
public void Parse(IBitStream bitstream) { var keys = new List<Key>(); while (!bitstream.ChunkFinished) { var desc = bitstream.ReadProtobufVarInt(); var wireType = desc & 7; var fieldnum = desc >> 3; if ((wireType == 0) && (fieldnum == 1)) { EventId = bitstream.ReadProtobufVarInt(); } else if ((wireType == 2) && (fieldnum == 2)) { Name = bitstream.ReadProtobufString(); } else if ((wireType == 2) && (fieldnum == 3)) { var length = bitstream.ReadProtobufVarInt(); bitstream.BeginChunk(length * 8); var key = new Key(); key.Parse(bitstream); keys.Add(key); bitstream.EndChunk(); } else throw new InvalidDataException(); } Keys = keys.ToArray(); }
public void Parse(IBitStream bitstream) { while (!bitstream.ChunkFinished) { var desc = bitstream.ReadProtobufVarInt(); var wireType = desc & 7; var fieldnum = desc >> 3; if (wireType == 2) { if (fieldnum == 2) { VarName = bitstream.ReadProtobufString(); } else if (fieldnum == 5) { DtName = bitstream.ReadProtobufString(); } else { throw new InvalidDataException("yes I know we should drop this but we" + "probably want to know that they added a new big field"); } } else if (wireType == 0) { var val = bitstream.ReadProtobufVarInt(); switch (fieldnum) { case 1: Type = val; break; case 3: Flags = val; break; case 4: Priority = val; break; case 6: NumElements = val; break; case 9: NumBits = val; break; } } else if (wireType == 5) { var val = bitstream.ReadFloat(); switch (fieldnum) { case 7: LowValue = val; break; case 8: HighValue = val; break; } } else { throw new InvalidDataException(); } } }
public IEnumerable<SendProp> Parse(IBitStream bitstream) { var sendprops = new List<SendProp>(); while (!bitstream.ChunkFinished) { var desc = bitstream.ReadProtobufVarInt(); var wireType = desc & 7; var fieldnum = desc >> 3; if (wireType == 2) { if (fieldnum == 2) { NetTableName = bitstream.ReadProtobufString(); } else if (fieldnum == 4) { // Props are special. // We'll simply hope that gaben is nice and sends // props last, just like he should. var len = bitstream.ReadProtobufVarInt(); bitstream.BeginChunk(len * 8); var sendprop = new SendProp(); sendprop.Parse(bitstream); sendprops.Add(sendprop); bitstream.EndChunk(); } else throw new InvalidDataException("yes I know we should drop this" + "but we probably want to know that they added a new big field"); } else if (wireType == 0) { var val = bitstream.ReadProtobufVarInt(); switch (fieldnum) { case 1: _IsEnd = val; break; case 3: _NeedsDecoder = val; break; default: // silently drop break; } } else throw new InvalidDataException(); } return sendprops; }
public void Parse(IBitStream bitstream, DemoParser parser) { while (!bitstream.ChunkFinished) { var desc = bitstream.ReadProtobufVarInt(); var wireType = desc & 7; var fieldnum = desc >> 3; if (wireType == 2) { if (fieldnum == 1) { Name = bitstream.ReadProtobufString(); continue; } else if (fieldnum == 8) { // String data is special. // We'll simply hope that gaben is nice and sends // string_data last, just like he should. var len = bitstream.ReadProtobufVarInt(); bitstream.BeginChunk(len * 8); DemoInfo.DP.Handler.CreateStringTableUserInfoHandler.Apply(this, bitstream, parser); bitstream.EndChunk(); if (!bitstream.ChunkFinished) { throw new NotImplementedException("Lord Gaben wasn't nice to us :/"); } break; } else { throw new Exception("yes I know we should drop this but we" + "probably want to know that they added a new big field"); } } if (wireType != 0) { throw new Exception(); } var val = bitstream.ReadProtobufVarInt(); switch (fieldnum) { case 2: MaxEntries = val; break; case 3: NumEntries = val; break; case 4: _UserDataFixedSize = val; break; case 5: UserDataSize = val; break; case 6: UserDataSizeBits = val; break; case 7: Flags = val; break; default: // silently drop break; } } }
public void Parse(IBitStream bitstream, DemoParser parser) { Keys = new List <object>(); while (!bitstream.ChunkFinished) { var desc = bitstream.ReadProtobufVarInt(); var wireType = desc & 7; var fieldnum = desc >> 3; if (wireType == 2 && fieldnum == 1) { EventName = bitstream.ReadProtobufString(); } else if (wireType == 0 && fieldnum == 2) { EventId = bitstream.ReadProtobufVarInt(); } else if (wireType == 2 && fieldnum == 3) { bitstream.BeginChunk(bitstream.ReadProtobufVarInt() * 8); /* * Hope and pray that gaben is once again nice to us and * sends 'type' first, then the respective member, then NOTHING. */ desc = bitstream.ReadProtobufVarInt(); wireType = desc & 7; fieldnum = desc >> 3; if (wireType != 0 || fieldnum != 1) { throw new InvalidDataException("Lord Gaben wasn't nice to us :/"); } var typeMember = bitstream.ReadProtobufVarInt(); desc = bitstream.ReadProtobufVarInt(); wireType = desc & 7; fieldnum = desc >> 3; if (fieldnum != typeMember + 1) { throw new InvalidDataException("Lord Gaben wasn't nice to us :/ (srsly wtf!?)"); } switch (typeMember) { case 1: // string if (wireType != 2) { throw new InvalidDataException("proto definition differs"); } Keys.Add(bitstream.ReadProtobufString()); break; case 2: // float if (wireType != 5) { throw new InvalidDataException("proto definition differs"); } Keys.Add(bitstream.ReadFloat()); break; case 3: // long case 4: // short case 5: // byte if (wireType != 0) { throw new InvalidDataException("proto definition differs"); } Keys.Add(bitstream.ReadProtobufVarInt()); break; case 6: // bool if (wireType != 0) { throw new InvalidDataException("proto definition differs"); } Keys.Add(bitstream.ReadProtobufVarInt() != 0); break; default: throw new InvalidDataException("Looks like they introduced a new type"); } if (!bitstream.ChunkFinished) { throw new InvalidDataException("Lord Gaben tricked us! D:"); } bitstream.EndChunk(); } else { throw new InvalidDataException(); } } GameEventHandler.Apply(this, parser); }
public void Parse(IBitStream bitstream, DemoParser parser) { while (!bitstream.ChunkFinished) { var desc = bitstream.ReadProtobufVarInt(); var wireType = desc & 7; var fieldnum = desc >> 3; if (wireType == 5) { if (fieldnum == 14) { parser.TickInterval = bitstream.ReadFloat(); } else { var val = bitstream.ReadInt(32); switch (fieldnum) { case 8: MapCrc = val; break; case 9: ClientCrc = val; break; case 10: StringTableCrc = val; break; } } } else if (wireType == 2) { var val = bitstream.ReadProtobufString(); switch (fieldnum) { case 15: GameDir = val; break; case 16: MapName = val; break; case 17: MapGroupName = val; break; case 18: SkyName = val; break; case 19: HostName = val; break; } } else if (wireType == 0) { var val = bitstream.ReadProtobufVarInt(); var boolval = (val == 0) ? false : true; switch (fieldnum) { case 1: Protocol = val; break; case 2: ServerCount = val; break; case 3: IsDedicated = boolval; break; case 4: IsOfficialValveServer = boolval; break; case 5: IsHltv = boolval; break; case 6: IsReplay = boolval; break; case 7: COs = val; break; case 11: MaxClients = val; break; case 12: MaxClasses = val; break; case 13: PlayerSlot = val; break; case 20: PublicIp = (uint)val; break; case 21: IsRedirectingToProxyRelay = boolval; break; case 22: UgcMapId = (uint)val; break; } } } }
public void Parse(IBitStream bitstream, DemoParser parser) { Keys = new List<object>(); while (!bitstream.ChunkFinished) { var desc = bitstream.ReadProtobufVarInt(); var wireType = desc & 7; var fieldnum = desc >> 3; if ((wireType == 2) && (fieldnum == 1)) { EventName = bitstream.ReadProtobufString(); } else if ((wireType == 0) && (fieldnum == 2)) { EventId = bitstream.ReadProtobufVarInt(); } else if ((wireType == 2) && (fieldnum == 3)) { bitstream.BeginChunk(bitstream.ReadProtobufVarInt() * 8); /* * Hope and pray that gaben is once again nice to us and * sends 'type' first, then the respective member, then NOTHING. */ desc = bitstream.ReadProtobufVarInt(); wireType = desc & 7; fieldnum = desc >> 3; if ((wireType != 0) || (fieldnum != 1)) throw new InvalidDataException("Lord Gaben wasn't nice to us :/"); var typeMember = bitstream.ReadProtobufVarInt(); desc = bitstream.ReadProtobufVarInt(); wireType = desc & 7; fieldnum = desc >> 3; if (fieldnum != (typeMember + 1)) throw new InvalidDataException("Lord Gaben wasn't nice to us :/ (srsly wtf!?)"); switch (typeMember) { case 1: // string if (wireType != 2) throw new InvalidDataException("proto definition differs"); Keys.Add(bitstream.ReadProtobufString()); break; case 2: // float if (wireType != 5) throw new InvalidDataException("proto definition differs"); Keys.Add(bitstream.ReadFloat()); break; case 3: // long case 4: // short case 5: // byte if (wireType != 0) throw new InvalidDataException("proto definition differs"); Keys.Add(bitstream.ReadProtobufVarInt()); break; case 6: // bool if (wireType != 0) throw new InvalidDataException("proto definition differs"); Keys.Add(bitstream.ReadProtobufVarInt() != 0); break; default: throw new InvalidDataException("Looks like they introduced a new type"); } if (!bitstream.ChunkFinished) throw new InvalidDataException("Lord Gaben tricked us! D:"); bitstream.EndChunk(); } else throw new InvalidDataException(); } GameEventHandler.Apply(this, parser); }