Exemple #1
0
        public static FindGameRequest DeserializeLengthDelimited(Stream stream, FindGameRequest instance)
        {
            long num = (long)((ulong)ProtocolParser.ReadUInt32(stream));

            num += stream.Position;
            return(FindGameRequest.Deserialize(stream, instance, num));
        }
Exemple #2
0
        public static FindGameRequest DeserializeLengthDelimited(Stream stream)
        {
            FindGameRequest findGameRequest = new FindGameRequest();

            FindGameRequest.DeserializeLengthDelimited(stream, findGameRequest);
            return(findGameRequest);
        }
Exemple #3
0
        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)
        {
            FindGameRequest findGameRequest = obj as FindGameRequest;

            if (findGameRequest == null)
            {
                return(false);
            }
            if (this.Player.Count != findGameRequest.Player.Count)
            {
                return(false);
            }
            for (int i = 0; i < this.Player.Count; i++)
            {
                if (!this.Player[i].Equals(findGameRequest.Player[i]))
                {
                    return(false);
                }
            }
            if (this.HasFactoryId != findGameRequest.HasFactoryId || this.HasFactoryId && !this.FactoryId.Equals(findGameRequest.FactoryId))
            {
                return(false);
            }
            if (this.HasProperties != findGameRequest.HasProperties || this.HasProperties && !this.Properties.Equals(findGameRequest.Properties))
            {
                return(false);
            }
            if (this.HasObjectId != findGameRequest.HasObjectId || this.HasObjectId && !this.ObjectId.Equals(findGameRequest.ObjectId))
            {
                return(false);
            }
            if (this.HasRequestId != findGameRequest.HasRequestId || this.HasRequestId && !this.RequestId.Equals(findGameRequest.RequestId))
            {
                return(false);
            }
            if (this.HasAdvancedNotification == findGameRequest.HasAdvancedNotification && (!this.HasAdvancedNotification || this.AdvancedNotification.Equals(findGameRequest.AdvancedNotification)))
            {
                return(true);
            }
            return(false);
        }
Exemple #5
0
        public override bool Equals(object obj)
        {
            FindGameRequest findGameRequest = obj as FindGameRequest;

            if (findGameRequest == null)
            {
                return(false);
            }
            if (this.Player.get_Count() != findGameRequest.Player.get_Count())
            {
                return(false);
            }
            for (int i = 0; i < this.Player.get_Count(); i++)
            {
                if (!this.Player.get_Item(i).Equals(findGameRequest.Player.get_Item(i)))
                {
                    return(false);
                }
            }
            return(this.HasFactoryId == findGameRequest.HasFactoryId && (!this.HasFactoryId || this.FactoryId.Equals(findGameRequest.FactoryId)) && this.HasProperties == findGameRequest.HasProperties && (!this.HasProperties || this.Properties.Equals(findGameRequest.Properties)) && this.HasObjectId == findGameRequest.HasObjectId && (!this.HasObjectId || this.ObjectId.Equals(findGameRequest.ObjectId)) && this.HasRequestId == findGameRequest.HasRequestId && (!this.HasRequestId || this.RequestId.Equals(findGameRequest.RequestId)) && this.HasAdvancedNotification == findGameRequest.HasAdvancedNotification && (!this.HasAdvancedNotification || this.AdvancedNotification.Equals(findGameRequest.AdvancedNotification)));
        }
Exemple #6
0
        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);
            }
        }
Exemple #7
0
 public void Serialize(Stream stream)
 {
     FindGameRequest.Serialize(stream, this);
 }
Exemple #8
0
        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");
        }
Exemple #9
0
 public static FindGameRequest Deserialize(Stream stream, FindGameRequest instance)
 {
     return(FindGameRequest.Deserialize(stream, instance, -1L));
 }