public static ChangeGameRequest DeserializeLengthDelimited(Stream stream)
        {
            ChangeGameRequest changeGameRequest = new ChangeGameRequest();

            ChangeGameRequest.DeserializeLengthDelimited(stream, changeGameRequest);
            return(changeGameRequest);
        }
 public static void Serialize(Stream stream, ChangeGameRequest instance)
 {
     if (instance.GameHandle == null)
     {
         throw new ArgumentNullException("GameHandle", "Required by proto specification.");
     }
     stream.WriteByte(10);
     ProtocolParser.WriteUInt32(stream, instance.GameHandle.GetSerializedSize());
     GameHandle.Serialize(stream, instance.GameHandle);
     if (instance.HasOpen)
     {
         stream.WriteByte(16);
         ProtocolParser.WriteBool(stream, instance.Open);
     }
     if (instance.Attribute.get_Count() > 0)
     {
         using (List <Attribute> .Enumerator enumerator = instance.Attribute.GetEnumerator())
         {
             while (enumerator.MoveNext())
             {
                 Attribute current = enumerator.get_Current();
                 stream.WriteByte(26);
                 ProtocolParser.WriteUInt32(stream, current.GetSerializedSize());
                 bnet.protocol.attribute.Attribute.Serialize(stream, current);
             }
         }
     }
     if (instance.HasReplace)
     {
         stream.WriteByte(32);
         ProtocolParser.WriteBool(stream, instance.Replace);
     }
 }
        public override bool Equals(object obj)
        {
            ChangeGameRequest changeGameRequest = obj as ChangeGameRequest;

            if (changeGameRequest == null)
            {
                return(false);
            }
            if (!this.GameHandle.Equals(changeGameRequest.GameHandle))
            {
                return(false);
            }
            if (this.HasOpen != changeGameRequest.HasOpen || (this.HasOpen && !this.Open.Equals(changeGameRequest.Open)))
            {
                return(false);
            }
            if (this.Attribute.get_Count() != changeGameRequest.Attribute.get_Count())
            {
                return(false);
            }
            for (int i = 0; i < this.Attribute.get_Count(); i++)
            {
                if (!this.Attribute.get_Item(i).Equals(changeGameRequest.Attribute.get_Item(i)))
                {
                    return(false);
                }
            }
            return(this.HasReplace == changeGameRequest.HasReplace && (!this.HasReplace || this.Replace.Equals(changeGameRequest.Replace)));
        }
        public static ChangeGameRequest DeserializeLengthDelimited(Stream stream, ChangeGameRequest instance)
        {
            long num = (long)((ulong)ProtocolParser.ReadUInt32(stream));

            num += stream.get_Position();
            return(ChangeGameRequest.Deserialize(stream, instance, num));
        }
 public static void Serialize(Stream stream, ChangeGameRequest instance)
 {
     if (instance.GameHandle == null)
     {
         throw new ArgumentNullException("GameHandle", "Required by proto specification.");
     }
     stream.WriteByte(10);
     ProtocolParser.WriteUInt32(stream, instance.GameHandle.GetSerializedSize());
     GameHandle.Serialize(stream, instance.GameHandle);
     if (instance.HasOpen)
     {
         stream.WriteByte(16);
         ProtocolParser.WriteBool(stream, instance.Open);
     }
     if (instance.Attribute.Count > 0)
     {
         foreach (bnet.protocol.attribute.Attribute attribute in instance.Attribute)
         {
             stream.WriteByte(26);
             ProtocolParser.WriteUInt32(stream, attribute.GetSerializedSize());
             bnet.protocol.attribute.Attribute.Serialize(stream, attribute);
         }
     }
     if (instance.HasReplace)
     {
         stream.WriteByte(32);
         ProtocolParser.WriteBool(stream, instance.Replace);
     }
 }
Beispiel #6
0
        public static ChangeGameRequest DeserializeLengthDelimited(Stream stream, ChangeGameRequest instance)
        {
            long position = (long)ProtocolParser.ReadUInt32(stream);

            position += stream.Position;
            return(ChangeGameRequest.Deserialize(stream, instance, position));
        }
 public static ChangeGameRequest Deserialize(Stream stream, ChangeGameRequest instance)
 {
     return(ChangeGameRequest.Deserialize(stream, instance, -1L));
 }
 public void Deserialize(Stream stream)
 {
     ChangeGameRequest.Deserialize(stream, this);
 }
 public static ChangeGameRequest Deserialize(Stream stream, ChangeGameRequest instance, long limit)
 {
     if (instance.Attribute == null)
     {
         instance.Attribute = new List <Attribute>();
     }
     instance.Replace = false;
     while (limit < 0L || stream.get_Position() < limit)
     {
         int num = stream.ReadByte();
         if (num == -1)
         {
             if (limit >= 0L)
             {
                 throw new EndOfStreamException();
             }
             return(instance);
         }
         else
         {
             int num2 = num;
             if (num2 != 10)
             {
                 if (num2 != 16)
                 {
                     if (num2 != 26)
                     {
                         if (num2 != 32)
                         {
                             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.Replace = ProtocolParser.ReadBool(stream);
                         }
                     }
                     else
                     {
                         instance.Attribute.Add(bnet.protocol.attribute.Attribute.DeserializeLengthDelimited(stream));
                     }
                 }
                 else
                 {
                     instance.Open = ProtocolParser.ReadBool(stream);
                 }
             }
             else if (instance.GameHandle == null)
             {
                 instance.GameHandle = GameHandle.DeserializeLengthDelimited(stream);
             }
             else
             {
                 GameHandle.DeserializeLengthDelimited(stream, instance.GameHandle);
             }
         }
     }
     if (stream.get_Position() == limit)
     {
         return(instance);
     }
     throw new ProtocolBufferException("Read past max limit");
 }
Beispiel #10
0
 public static ChangeGameRequest Deserialize(Stream stream, ChangeGameRequest instance, long limit)
 {
     if (instance.Attribute == null)
     {
         instance.Attribute = new List <bnet.protocol.attribute.Attribute>();
     }
     instance.Replace = false;
     while (true)
     {
         if (limit < (long)0 || stream.Position < limit)
         {
             int num = stream.ReadByte();
             if (num == -1)
             {
                 if (limit >= (long)0)
                 {
                     throw new EndOfStreamException();
                 }
                 break;
             }
             else if (num == 10)
             {
                 if (instance.GameHandle != null)
                 {
                     bnet.protocol.game_master.GameHandle.DeserializeLengthDelimited(stream, instance.GameHandle);
                 }
                 else
                 {
                     instance.GameHandle = bnet.protocol.game_master.GameHandle.DeserializeLengthDelimited(stream);
                 }
             }
             else if (num == 16)
             {
                 instance.Open = ProtocolParser.ReadBool(stream);
             }
             else if (num == 26)
             {
                 instance.Attribute.Add(bnet.protocol.attribute.Attribute.DeserializeLengthDelimited(stream));
             }
             else if (num == 32)
             {
                 instance.Replace = ProtocolParser.ReadBool(stream);
             }
             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);
             }
         }
         else
         {
             if (stream.Position != limit)
             {
                 throw new ProtocolBufferException("Read past max limit");
             }
             break;
         }
     }
     return(instance);
 }