Exemplo n.º 1
0
        public static ConnectionMeteringContentHandles DeserializeLengthDelimited(Stream stream, ConnectionMeteringContentHandles instance)
        {
            long position = (long)ProtocolParser.ReadUInt32(stream);

            position += stream.Position;
            return(ConnectionMeteringContentHandles.Deserialize(stream, instance, position));
        }
Exemplo n.º 2
0
        public static ConnectionMeteringContentHandles DeserializeLengthDelimited(Stream stream, ConnectionMeteringContentHandles instance)
        {
            long num = (long)((ulong)ProtocolParser.ReadUInt32(stream));

            num += stream.get_Position();
            return(ConnectionMeteringContentHandles.Deserialize(stream, instance, num));
        }
Exemplo n.º 3
0
        public static ConnectionMeteringContentHandles DeserializeLengthDelimited(Stream stream)
        {
            ConnectionMeteringContentHandles connectionMeteringContentHandle = new ConnectionMeteringContentHandles();

            ConnectionMeteringContentHandles.DeserializeLengthDelimited(stream, connectionMeteringContentHandle);
            return(connectionMeteringContentHandle);
        }
Exemplo n.º 4
0
 public static void Serialize(Stream stream, ConnectionMeteringContentHandles instance)
 {
     if (instance.ContentHandle.Count > 0)
     {
         foreach (bnet.protocol.ContentHandle contentHandle in instance.ContentHandle)
         {
             stream.WriteByte(10);
             ProtocolParser.WriteUInt32(stream, contentHandle.GetSerializedSize());
             bnet.protocol.ContentHandle.Serialize(stream, contentHandle);
         }
     }
 }
Exemplo n.º 5
0
 public static void Serialize(Stream stream, ConnectionMeteringContentHandles instance)
 {
     if (instance.ContentHandle.get_Count() > 0)
     {
         using (List <ContentHandle> .Enumerator enumerator = instance.ContentHandle.GetEnumerator())
         {
             while (enumerator.MoveNext())
             {
                 ContentHandle current = enumerator.get_Current();
                 stream.WriteByte(10);
                 ProtocolParser.WriteUInt32(stream, current.GetSerializedSize());
                 bnet.protocol.ContentHandle.Serialize(stream, current);
             }
         }
     }
 }
Exemplo n.º 6
0
 public static ConnectionMeteringContentHandles Deserialize(Stream stream, ConnectionMeteringContentHandles instance, long limit)
 {
     if (instance.ContentHandle == null)
     {
         instance.ContentHandle = new List <bnet.protocol.ContentHandle>();
     }
     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)
             {
                 instance.ContentHandle.Add(bnet.protocol.ContentHandle.DeserializeLengthDelimited(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);
 }
Exemplo n.º 7
0
 public static ConnectionMeteringContentHandles Deserialize(Stream stream, ConnectionMeteringContentHandles instance, long limit)
 {
     if (instance.ContentHandle == null)
     {
         instance.ContentHandle = new List <ContentHandle>();
     }
     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)
             {
                 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.ContentHandle.Add(bnet.protocol.ContentHandle.DeserializeLengthDelimited(stream));
             }
         }
     }
     if (stream.get_Position() == limit)
     {
         return(instance);
     }
     throw new ProtocolBufferException("Read past max limit");
 }
Exemplo n.º 8
0
        public override bool Equals(object obj)
        {
            ConnectionMeteringContentHandles connectionMeteringContentHandle = obj as ConnectionMeteringContentHandles;

            if (connectionMeteringContentHandle == null)
            {
                return(false);
            }
            if (this.ContentHandle.Count != connectionMeteringContentHandle.ContentHandle.Count)
            {
                return(false);
            }
            for (int i = 0; i < this.ContentHandle.Count; i++)
            {
                if (!this.ContentHandle[i].Equals(connectionMeteringContentHandle.ContentHandle[i]))
                {
                    return(false);
                }
            }
            return(true);
        }
Exemplo n.º 9
0
        public override bool Equals(object obj)
        {
            ConnectionMeteringContentHandles connectionMeteringContentHandles = obj as ConnectionMeteringContentHandles;

            if (connectionMeteringContentHandles == null)
            {
                return(false);
            }
            if (this.ContentHandle.get_Count() != connectionMeteringContentHandles.ContentHandle.get_Count())
            {
                return(false);
            }
            for (int i = 0; i < this.ContentHandle.get_Count(); i++)
            {
                if (!this.ContentHandle.get_Item(i).Equals(connectionMeteringContentHandles.ContentHandle.get_Item(i)))
                {
                    return(false);
                }
            }
            return(true);
        }
Exemplo n.º 10
0
 public static void Serialize(Stream stream, ConnectResponse instance)
 {
     if (instance.ServerId == null)
     {
         throw new ArgumentNullException("ServerId", "Required by proto specification.");
     }
     stream.WriteByte(10);
     ProtocolParser.WriteUInt32(stream, instance.ServerId.GetSerializedSize());
     ProcessId.Serialize(stream, instance.ServerId);
     if (instance.HasClientId)
     {
         stream.WriteByte(18);
         ProtocolParser.WriteUInt32(stream, instance.ClientId.GetSerializedSize());
         ProcessId.Serialize(stream, instance.ClientId);
     }
     if (instance.HasBindResult)
     {
         stream.WriteByte(24);
         ProtocolParser.WriteUInt32(stream, instance.BindResult);
     }
     if (instance.HasBindResponse)
     {
         stream.WriteByte(34);
         ProtocolParser.WriteUInt32(stream, instance.BindResponse.GetSerializedSize());
         bnet.protocol.connection.BindResponse.Serialize(stream, instance.BindResponse);
     }
     if (instance.HasContentHandleArray)
     {
         stream.WriteByte(42);
         ProtocolParser.WriteUInt32(stream, instance.ContentHandleArray.GetSerializedSize());
         ConnectionMeteringContentHandles.Serialize(stream, instance.ContentHandleArray);
     }
     if (instance.HasServerTime)
     {
         stream.WriteByte(48);
         ProtocolParser.WriteUInt64(stream, instance.ServerTime);
     }
 }
Exemplo n.º 11
0
 public static ConnectionMeteringContentHandles Deserialize(Stream stream, ConnectionMeteringContentHandles instance)
 {
     return(ConnectionMeteringContentHandles.Deserialize(stream, instance, (long)-1));
 }
Exemplo n.º 12
0
 public void Deserialize(Stream stream)
 {
     ConnectionMeteringContentHandles.Deserialize(stream, this);
 }
Exemplo n.º 13
0
 public void SetContentHandleArray(ConnectionMeteringContentHandles val)
 {
     this.ContentHandleArray = val;
 }
Exemplo n.º 14
0
 public static ConnectResponse Deserialize(Stream stream, ConnectResponse instance, long limit)
 {
     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.ServerId != null)
                 {
                     ProcessId.DeserializeLengthDelimited(stream, instance.ServerId);
                 }
                 else
                 {
                     instance.ServerId = ProcessId.DeserializeLengthDelimited(stream);
                 }
             }
             else if (num == 18)
             {
                 if (instance.ClientId != null)
                 {
                     ProcessId.DeserializeLengthDelimited(stream, instance.ClientId);
                 }
                 else
                 {
                     instance.ClientId = ProcessId.DeserializeLengthDelimited(stream);
                 }
             }
             else if (num == 24)
             {
                 instance.BindResult = ProtocolParser.ReadUInt32(stream);
             }
             else if (num == 34)
             {
                 if (instance.BindResponse != null)
                 {
                     bnet.protocol.connection.BindResponse.DeserializeLengthDelimited(stream, instance.BindResponse);
                 }
                 else
                 {
                     instance.BindResponse = bnet.protocol.connection.BindResponse.DeserializeLengthDelimited(stream);
                 }
             }
             else if (num != 42)
             {
                 if (num == 48)
                 {
                     instance.ServerTime = ProtocolParser.ReadUInt64(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 (instance.ContentHandleArray != null)
             {
                 ConnectionMeteringContentHandles.DeserializeLengthDelimited(stream, instance.ContentHandleArray);
             }
             else
             {
                 instance.ContentHandleArray = ConnectionMeteringContentHandles.DeserializeLengthDelimited(stream);
             }
         }
         else
         {
             if (stream.Position != limit)
             {
                 throw new ProtocolBufferException("Read past max limit");
             }
             break;
         }
     }
     return(instance);
 }
Exemplo n.º 15
0
 public static ConnectResponse Deserialize(Stream stream, ConnectResponse instance, long limit)
 {
     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 != 18)
                 {
                     if (num2 != 24)
                     {
                         if (num2 != 34)
                         {
                             if (num2 != 42)
                             {
                                 if (num2 != 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.ServerTime = ProtocolParser.ReadUInt64(stream);
                                 }
                             }
                             else if (instance.ContentHandleArray == null)
                             {
                                 instance.ContentHandleArray = ConnectionMeteringContentHandles.DeserializeLengthDelimited(stream);
                             }
                             else
                             {
                                 ConnectionMeteringContentHandles.DeserializeLengthDelimited(stream, instance.ContentHandleArray);
                             }
                         }
                         else if (instance.BindResponse == null)
                         {
                             instance.BindResponse = BindResponse.DeserializeLengthDelimited(stream);
                         }
                         else
                         {
                             BindResponse.DeserializeLengthDelimited(stream, instance.BindResponse);
                         }
                     }
                     else
                     {
                         instance.BindResult = ProtocolParser.ReadUInt32(stream);
                     }
                 }
                 else if (instance.ClientId == null)
                 {
                     instance.ClientId = ProcessId.DeserializeLengthDelimited(stream);
                 }
                 else
                 {
                     ProcessId.DeserializeLengthDelimited(stream, instance.ClientId);
                 }
             }
             else if (instance.ServerId == null)
             {
                 instance.ServerId = ProcessId.DeserializeLengthDelimited(stream);
             }
             else
             {
                 ProcessId.DeserializeLengthDelimited(stream, instance.ServerId);
             }
         }
     }
     if (stream.get_Position() == limit)
     {
         return(instance);
     }
     throw new ProtocolBufferException("Read past max limit");
 }