public static void Serialize(Stream stream, FindGameRequest instance) { BinaryWriter binaryWriter = new BinaryWriter(stream); if (instance.Player.get_Count() > 0) { using (List <Player> .Enumerator enumerator = instance.Player.GetEnumerator()) { while (enumerator.MoveNext()) { Player current = enumerator.get_Current(); stream.WriteByte(10); ProtocolParser.WriteUInt32(stream, current.GetSerializedSize()); bnet.protocol.game_master.Player.Serialize(stream, current); } } } if (instance.HasFactoryId) { stream.WriteByte(17); binaryWriter.Write(instance.FactoryId); } if (instance.HasProperties) { stream.WriteByte(26); ProtocolParser.WriteUInt32(stream, instance.Properties.GetSerializedSize()); GameProperties.Serialize(stream, instance.Properties); } if (instance.HasObjectId) { stream.WriteByte(32); ProtocolParser.WriteUInt64(stream, instance.ObjectId); } if (instance.HasRequestId) { stream.WriteByte(41); binaryWriter.Write(instance.RequestId); } if (instance.HasAdvancedNotification) { stream.WriteByte(48); ProtocolParser.WriteBool(stream, instance.AdvancedNotification); } }
public override bool Equals(object obj) { GameProperties gameProperties = obj as GameProperties; if (gameProperties == null) { return(false); } if (this.CreationAttributes.Count != gameProperties.CreationAttributes.Count) { return(false); } for (int i = 0; i < this.CreationAttributes.Count; i++) { if (!this.CreationAttributes[i].Equals(gameProperties.CreationAttributes[i])) { return(false); } } return(this.HasFilter == gameProperties.HasFilter && (!this.HasFilter || this.Filter.Equals(gameProperties.Filter)) && this.HasCreate == gameProperties.HasCreate && (!this.HasCreate || this.Create.Equals(gameProperties.Create)) && this.HasOpen == gameProperties.HasOpen && (!this.HasOpen || this.Open.Equals(gameProperties.Open)) && this.HasProgramId == gameProperties.HasProgramId && (!this.HasProgramId || this.ProgramId.Equals(gameProperties.ProgramId))); }
public static void Serialize(Stream stream, FindGameRequest instance) { BinaryWriter binaryWriter = new BinaryWriter(stream); if (instance.Player.Count > 0) { foreach (Player player in instance.Player) { stream.WriteByte(10); ProtocolParser.WriteUInt32(stream, player.GetSerializedSize()); bnet.protocol.game_master.Player.Serialize(stream, player); } } if (instance.HasFactoryId) { stream.WriteByte(17); binaryWriter.Write(instance.FactoryId); } if (instance.HasProperties) { stream.WriteByte(26); ProtocolParser.WriteUInt32(stream, instance.Properties.GetSerializedSize()); GameProperties.Serialize(stream, instance.Properties); } if (instance.HasObjectId) { stream.WriteByte(32); ProtocolParser.WriteUInt64(stream, instance.ObjectId); } if (instance.HasRequestId) { stream.WriteByte(41); binaryWriter.Write(instance.RequestId); } if (instance.HasAdvancedNotification) { stream.WriteByte(48); ProtocolParser.WriteBool(stream, instance.AdvancedNotification); } }
public static void Serialize(Stream stream, GameProperties instance) { BinaryWriter binaryWriter = new BinaryWriter(stream); if (instance.CreationAttributes.get_Count() > 0) { using (List <Attribute> .Enumerator enumerator = instance.CreationAttributes.GetEnumerator()) { while (enumerator.MoveNext()) { Attribute current = enumerator.get_Current(); stream.WriteByte(10); ProtocolParser.WriteUInt32(stream, current.GetSerializedSize()); Attribute.Serialize(stream, current); } } } if (instance.HasFilter) { stream.WriteByte(18); ProtocolParser.WriteUInt32(stream, instance.Filter.GetSerializedSize()); AttributeFilter.Serialize(stream, instance.Filter); } if (instance.HasCreate) { stream.WriteByte(24); ProtocolParser.WriteBool(stream, instance.Create); } if (instance.HasOpen) { stream.WriteByte(32); ProtocolParser.WriteBool(stream, instance.Open); } if (instance.HasProgramId) { stream.WriteByte(45); binaryWriter.Write(instance.ProgramId); } }
public void Serialize(Stream stream) { GameProperties.Serialize(stream, this); }
public static GameProperties Deserialize(Stream stream, GameProperties instance, long limit) { BinaryReader binaryReader = new BinaryReader(stream); if (instance.CreationAttributes == null) { instance.CreationAttributes = new List <bnet.protocol.attribute.Attribute>(); } instance.Create = false; instance.Open = true; 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 != 24) { if (num != 32) { if (num != 45) { 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 { instance.Open = ProtocolParser.ReadBool(stream); } } else { instance.Create = ProtocolParser.ReadBool(stream); } } else if (instance.Filter == null) { instance.Filter = AttributeFilter.DeserializeLengthDelimited(stream); } else { AttributeFilter.DeserializeLengthDelimited(stream, instance.Filter); } } else { instance.CreationAttributes.Add(bnet.protocol.attribute.Attribute.DeserializeLengthDelimited(stream)); } } if (stream.Position == limit) { return(instance); } throw new ProtocolBufferException("Read past max limit"); }
public static GameProperties Deserialize(Stream stream, GameProperties instance) { return(GameProperties.Deserialize(stream, instance, -1L)); }
public void SetProperties(GameProperties val) { this.Properties = val; }
public static FindGameRequest Deserialize(Stream stream, FindGameRequest instance, long limit) { BinaryReader binaryReader = new BinaryReader(stream); if (instance.Player == null) { instance.Player = new List <Player>(); } instance.AdvancedNotification = false; 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 != 17) { if (num != 26) { if (num != 32) { if (num != 41) { if (num != 48) { 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.AdvancedNotification = ProtocolParser.ReadBool(stream); } } else { instance.RequestId = binaryReader.ReadUInt64(); } } else { instance.ObjectId = ProtocolParser.ReadUInt64(stream); } } else if (instance.Properties == null) { instance.Properties = GameProperties.DeserializeLengthDelimited(stream); } else { GameProperties.DeserializeLengthDelimited(stream, instance.Properties); } } else { instance.FactoryId = binaryReader.ReadUInt64(); } } else { instance.Player.Add(bnet.protocol.game_master.Player.DeserializeLengthDelimited(stream)); } } if (stream.Position == limit) { return(instance); } throw new ProtocolBufferException("Read past max limit"); }