public static SendChallengeToUserRequest DeserializeLengthDelimited(Stream stream, SendChallengeToUserRequest instance) { long num = (long)((ulong)ProtocolParser.ReadUInt32(stream)); num += stream.get_Position(); return(SendChallengeToUserRequest.Deserialize(stream, instance, num)); }
public static SendChallengeToUserRequest DeserializeLengthDelimited(Stream stream) { SendChallengeToUserRequest sendChallengeToUserRequest = new SendChallengeToUserRequest(); SendChallengeToUserRequest.DeserializeLengthDelimited(stream, sendChallengeToUserRequest); return(sendChallengeToUserRequest); }
public static SendChallengeToUserRequest DeserializeLengthDelimited(Stream stream, SendChallengeToUserRequest instance) { long position = (long)ProtocolParser.ReadUInt32(stream); position += stream.Position; return(SendChallengeToUserRequest.Deserialize(stream, instance, position)); }
public static void Serialize(Stream stream, SendChallengeToUserRequest instance) { BinaryWriter binaryWriter = new BinaryWriter(stream); if (instance.HasPeerId) { stream.WriteByte(10); ProtocolParser.WriteUInt32(stream, instance.PeerId.GetSerializedSize()); ProcessId.Serialize(stream, instance.PeerId); } if (instance.HasGameAccountId) { stream.WriteByte(18); ProtocolParser.WriteUInt32(stream, instance.GameAccountId.GetSerializedSize()); EntityId.Serialize(stream, instance.GameAccountId); } if (instance.Challenges.get_Count() > 0) { using (List <Challenge> .Enumerator enumerator = instance.Challenges.GetEnumerator()) { while (enumerator.MoveNext()) { Challenge current = enumerator.get_Current(); stream.WriteByte(26); ProtocolParser.WriteUInt32(stream, current.GetSerializedSize()); Challenge.Serialize(stream, current); } } } stream.WriteByte(37); binaryWriter.Write(instance.Context); if (instance.HasTimeout) { stream.WriteByte(40); ProtocolParser.WriteUInt64(stream, instance.Timeout); } if (instance.Attributes.get_Count() > 0) { using (List <Attribute> .Enumerator enumerator2 = instance.Attributes.GetEnumerator()) { while (enumerator2.MoveNext()) { Attribute current2 = enumerator2.get_Current(); stream.WriteByte(50); ProtocolParser.WriteUInt32(stream, current2.GetSerializedSize()); Attribute.Serialize(stream, current2); } } } }
public override bool Equals(object obj) { SendChallengeToUserRequest sendChallengeToUserRequest = obj as SendChallengeToUserRequest; if (sendChallengeToUserRequest == null) { return(false); } if (this.HasPeerId != sendChallengeToUserRequest.HasPeerId || (this.HasPeerId && !this.PeerId.Equals(sendChallengeToUserRequest.PeerId))) { return(false); } if (this.HasGameAccountId != sendChallengeToUserRequest.HasGameAccountId || (this.HasGameAccountId && !this.GameAccountId.Equals(sendChallengeToUserRequest.GameAccountId))) { return(false); } if (this.Challenges.get_Count() != sendChallengeToUserRequest.Challenges.get_Count()) { return(false); } for (int i = 0; i < this.Challenges.get_Count(); i++) { if (!this.Challenges.get_Item(i).Equals(sendChallengeToUserRequest.Challenges.get_Item(i))) { return(false); } } if (!this.Context.Equals(sendChallengeToUserRequest.Context)) { return(false); } if (this.HasTimeout != sendChallengeToUserRequest.HasTimeout || (this.HasTimeout && !this.Timeout.Equals(sendChallengeToUserRequest.Timeout))) { return(false); } if (this.Attributes.get_Count() != sendChallengeToUserRequest.Attributes.get_Count()) { return(false); } for (int j = 0; j < this.Attributes.get_Count(); j++) { if (!this.Attributes.get_Item(j).Equals(sendChallengeToUserRequest.Attributes.get_Item(j))) { return(false); } } return(true); }
public static void Serialize(Stream stream, SendChallengeToUserRequest instance) { BinaryWriter binaryWriter = new BinaryWriter(stream); if (instance.HasPeerId) { stream.WriteByte(10); ProtocolParser.WriteUInt32(stream, instance.PeerId.GetSerializedSize()); ProcessId.Serialize(stream, instance.PeerId); } if (instance.HasGameAccountId) { stream.WriteByte(18); ProtocolParser.WriteUInt32(stream, instance.GameAccountId.GetSerializedSize()); EntityId.Serialize(stream, instance.GameAccountId); } if (instance.Challenges.Count > 0) { foreach (Challenge challenge in instance.Challenges) { stream.WriteByte(26); ProtocolParser.WriteUInt32(stream, challenge.GetSerializedSize()); Challenge.Serialize(stream, challenge); } } stream.WriteByte(37); binaryWriter.Write(instance.Context); if (instance.HasTimeout) { stream.WriteByte(40); ProtocolParser.WriteUInt64(stream, instance.Timeout); } if (instance.Attributes.Count > 0) { foreach (bnet.protocol.attribute.Attribute attribute in instance.Attributes) { stream.WriteByte(50); ProtocolParser.WriteUInt32(stream, attribute.GetSerializedSize()); bnet.protocol.attribute.Attribute.Serialize(stream, attribute); } } }
public void Serialize(Stream stream) { SendChallengeToUserRequest.Serialize(stream, this); }
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 SendChallengeToUserRequest Deserialize(Stream stream, SendChallengeToUserRequest instance) { return(SendChallengeToUserRequest.Deserialize(stream, instance, -1L)); }
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 <bnet.protocol.attribute.Attribute>(); } while (true) { if (limit < (long)0 || stream.Position < limit) { int num = stream.ReadByte(); if (num != -1) { switch (num) { case 37: { instance.Context = binaryReader.ReadUInt32(); continue; } case 40: { instance.Timeout = ProtocolParser.ReadUInt64(stream); continue; } default: { if (num == 10) { if (instance.PeerId != null) { ProcessId.DeserializeLengthDelimited(stream, instance.PeerId); } else { instance.PeerId = ProcessId.DeserializeLengthDelimited(stream); } continue; } else if (num == 18) { if (instance.GameAccountId != null) { EntityId.DeserializeLengthDelimited(stream, instance.GameAccountId); } else { instance.GameAccountId = EntityId.DeserializeLengthDelimited(stream); } continue; } else if (num == 26) { instance.Challenges.Add(Challenge.DeserializeLengthDelimited(stream)); continue; } else if (num == 50) { instance.Attributes.Add(bnet.protocol.attribute.Attribute.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); }