public static Challenge DeserializeLengthDelimited(Stream stream) { Challenge challenge = new Challenge(); Challenge.DeserializeLengthDelimited(stream, challenge); return(challenge); }
public static SendChallengeToUserRequest Deserialize(Stream stream, SendChallengeToUserRequest instance, long limit) { BinaryReader binaryReader = new BinaryReader(stream); if (instance.Challenges == null) { instance.Challenges = new List <Challenge>(); } if (instance.Attributes == null) { instance.Attributes = new List <Attribute>(); } while (limit < 0L || stream.get_Position() < limit) { int num = stream.ReadByte(); if (num != -1) { int num2 = num; switch (num2) { case 37: instance.Context = binaryReader.ReadUInt32(); continue; case 38: case 39: { IL_9F: if (num2 == 10) { if (instance.PeerId == null) { instance.PeerId = ProcessId.DeserializeLengthDelimited(stream); } else { ProcessId.DeserializeLengthDelimited(stream, instance.PeerId); } continue; } if (num2 == 18) { if (instance.GameAccountId == null) { instance.GameAccountId = EntityId.DeserializeLengthDelimited(stream); } else { EntityId.DeserializeLengthDelimited(stream, instance.GameAccountId); } continue; } if (num2 == 26) { instance.Challenges.Add(Challenge.DeserializeLengthDelimited(stream)); continue; } if (num2 == 50) { instance.Attributes.Add(Attribute.DeserializeLengthDelimited(stream)); continue; } Key key = ProtocolParser.ReadKey((byte)num, stream); uint field = key.Field; if (field != 0u) { ProtocolParser.SkipKey(stream, key); continue; } throw new ProtocolBufferException("Invalid field id: 0, something went wrong in the stream"); } case 40: instance.Timeout = ProtocolParser.ReadUInt64(stream); continue; } goto IL_9F; } if (limit >= 0L) { throw new EndOfStreamException(); } return(instance); } if (stream.get_Position() == limit) { return(instance); } throw new ProtocolBufferException("Read past max limit"); }
public static ChallengeUserRequest Deserialize(Stream stream, ChallengeUserRequest instance, long limit) { BinaryReader binaryReader = new BinaryReader(stream); if (instance.Challenges == null) { instance.Challenges = new List <Challenge>(); } if (instance.Attributes == null) { instance.Attributes = new List <bnet.protocol.attribute.Attribute>(); } while (true) { if (limit < (long)0 || stream.Position < limit) { int num = stream.ReadByte(); if (num != -1) { switch (num) { case 21: { instance.Context = binaryReader.ReadUInt32(); continue; } case 24: { instance.Id = ProtocolParser.ReadUInt32(stream); continue; } default: { if (num == 10) { instance.Challenges.Add(Challenge.DeserializeLengthDelimited(stream)); continue; } else if (num == 32) { instance.Deadline = ProtocolParser.ReadUInt64(stream); continue; } else if (num == 42) { instance.Attributes.Add(bnet.protocol.attribute.Attribute.DeserializeLengthDelimited(stream)); continue; } else if (num == 50) { if (instance.GameAccountId != null) { EntityId.DeserializeLengthDelimited(stream, instance.GameAccountId); } else { instance.GameAccountId = EntityId.DeserializeLengthDelimited(stream); } continue; } else { Key key = ProtocolParser.ReadKey((byte)num, stream); if (key.Field == 0) { throw new ProtocolBufferException("Invalid field id: 0, something went wrong in the stream"); } ProtocolParser.SkipKey(stream, key); continue; } } } } else { if (limit >= (long)0) { throw new EndOfStreamException(); } break; } } else { if (stream.Position != limit) { throw new ProtocolBufferException("Read past max limit"); } break; } } return(instance); }