public static RegisterServerRequest DeserializeLengthDelimited(Stream stream, RegisterServerRequest instance) { long num = (long)((ulong)ProtocolParser.ReadUInt32(stream)); num += stream.get_Position(); return(RegisterServerRequest.Deserialize(stream, instance, num)); }
public static void Serialize(Stream stream, RegisterServerRequest instance) { BinaryWriter binaryWriter = new BinaryWriter(stream); if (instance.Attribute.get_Count() > 0) { using (List <Attribute> .Enumerator enumerator = instance.Attribute.GetEnumerator()) { while (enumerator.MoveNext()) { Attribute current = enumerator.get_Current(); stream.WriteByte(10); ProtocolParser.WriteUInt32(stream, current.GetSerializedSize()); bnet.protocol.attribute.Attribute.Serialize(stream, current); } } } if (instance.HasState) { stream.WriteByte(18); ProtocolParser.WriteUInt32(stream, instance.State.GetSerializedSize()); ServerState.Serialize(stream, instance.State); } stream.WriteByte(29); binaryWriter.Write(instance.ProgramId); }
public static RegisterServerRequest DeserializeLengthDelimited(Stream stream) { RegisterServerRequest registerServerRequest = new RegisterServerRequest(); RegisterServerRequest.DeserializeLengthDelimited(stream, registerServerRequest); return(registerServerRequest); }
public override bool Equals(object obj) { RegisterServerRequest registerServerRequest = obj as RegisterServerRequest; if (registerServerRequest == null) { return(false); } if (this.Attribute.Count != registerServerRequest.Attribute.Count) { return(false); } for (int i = 0; i < this.Attribute.Count; i++) { if (!this.Attribute[i].Equals(registerServerRequest.Attribute[i])) { return(false); } } if (this.HasState != registerServerRequest.HasState || this.HasState && !this.State.Equals(registerServerRequest.State)) { return(false); } if (!this.ProgramId.Equals(registerServerRequest.ProgramId)) { return(false); } return(true); }
public static RegisterServerRequest DeserializeLengthDelimited(Stream stream, RegisterServerRequest instance) { long position = (long)ProtocolParser.ReadUInt32(stream); position += stream.Position; return(RegisterServerRequest.Deserialize(stream, instance, position)); }
public static RegisterServerRequest Deserialize(Stream stream, RegisterServerRequest instance, long limit) { BinaryReader binaryReader = new BinaryReader(stream); if (instance.Attribute == null) { instance.Attribute = new List <bnet.protocol.attribute.Attribute>(); } while (limit < 0L || stream.Position < limit) { int num = stream.ReadByte(); if (num == -1) { if (limit >= 0L) { throw new EndOfStreamException(); } return(instance); } else if (num != 10) { if (num != 18) { if (num != 29) { Key key = ProtocolParser.ReadKey((byte)num, stream); uint field = key.Field; if (field == 0u) { throw new ProtocolBufferException("Invalid field id: 0, something went wrong in the stream"); } ProtocolParser.SkipKey(stream, key); } else { instance.ProgramId = binaryReader.ReadUInt32(); } } else if (instance.State == null) { instance.State = ServerState.DeserializeLengthDelimited(stream); } else { ServerState.DeserializeLengthDelimited(stream, instance.State); } } else { instance.Attribute.Add(bnet.protocol.attribute.Attribute.DeserializeLengthDelimited(stream)); } } if (stream.Position == limit) { return(instance); } throw new ProtocolBufferException("Read past max limit"); }
public override bool Equals(object obj) { RegisterServerRequest registerServerRequest = obj as RegisterServerRequest; if (registerServerRequest == null) { return(false); } if (this.Attribute.get_Count() != registerServerRequest.Attribute.get_Count()) { return(false); } for (int i = 0; i < this.Attribute.get_Count(); i++) { if (!this.Attribute.get_Item(i).Equals(registerServerRequest.Attribute.get_Item(i))) { return(false); } } return(this.HasState == registerServerRequest.HasState && (!this.HasState || this.State.Equals(registerServerRequest.State)) && this.ProgramId.Equals(registerServerRequest.ProgramId)); }
public static void Serialize(Stream stream, RegisterServerRequest instance) { BinaryWriter binaryWriter = new BinaryWriter(stream); if (instance.Attribute.Count > 0) { foreach (bnet.protocol.attribute.Attribute attribute in instance.Attribute) { stream.WriteByte(10); ProtocolParser.WriteUInt32(stream, attribute.GetSerializedSize()); bnet.protocol.attribute.Attribute.Serialize(stream, attribute); } } if (instance.HasState) { stream.WriteByte(18); ProtocolParser.WriteUInt32(stream, instance.State.GetSerializedSize()); ServerState.Serialize(stream, instance.State); } stream.WriteByte(29); binaryWriter.Write(instance.ProgramId); }
public static RegisterServerRequest Deserialize(Stream stream, RegisterServerRequest instance) { return(RegisterServerRequest.Deserialize(stream, instance, -1L)); }
public void Deserialize(Stream stream) { RegisterServerRequest.Deserialize(stream, this); }