示例#1
0
        public static PoolStateResponse DeserializeLengthDelimited(Stream stream)
        {
            PoolStateResponse poolStateResponse = new PoolStateResponse();

            PoolStateResponse.DeserializeLengthDelimited(stream, poolStateResponse);
            return(poolStateResponse);
        }
示例#2
0
        public static PoolStateResponse DeserializeLengthDelimited(Stream stream, PoolStateResponse instance)
        {
            long num = (long)((ulong)ProtocolParser.ReadUInt32(stream));

            num += stream.Position;
            return(PoolStateResponse.Deserialize(stream, instance, num));
        }
示例#3
0
 public static void Serialize(Stream stream, PoolStateResponse instance)
 {
     if (instance.Info.Count > 0)
     {
         foreach (ServerInfo serverInfo in instance.Info)
         {
             stream.WriteByte(10);
             ProtocolParser.WriteUInt32(stream, serverInfo.GetSerializedSize());
             ServerInfo.Serialize(stream, serverInfo);
         }
     }
 }
 public static void Serialize(Stream stream, PoolStateResponse instance)
 {
     if (instance.Info.get_Count() > 0)
     {
         using (List <ServerInfo> .Enumerator enumerator = instance.Info.GetEnumerator())
         {
             while (enumerator.MoveNext())
             {
                 ServerInfo current = enumerator.get_Current();
                 stream.WriteByte(10);
                 ProtocolParser.WriteUInt32(stream, current.GetSerializedSize());
                 ServerInfo.Serialize(stream, current);
             }
         }
     }
 }
示例#5
0
 public static PoolStateResponse Deserialize(Stream stream, PoolStateResponse instance, long limit)
 {
     if (instance.Info == null)
     {
         instance.Info = new List <ServerInfo>();
     }
     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.Info.Add(ServerInfo.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);
 }
 public static PoolStateResponse Deserialize(Stream stream, PoolStateResponse instance, long limit)
 {
     if (instance.Info == null)
     {
         instance.Info = new List <ServerInfo>();
     }
     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.Info.Add(ServerInfo.DeserializeLengthDelimited(stream));
             }
         }
     }
     if (stream.get_Position() == limit)
     {
         return(instance);
     }
     throw new ProtocolBufferException("Read past max limit");
 }
示例#7
0
        public override bool Equals(object obj)
        {
            PoolStateResponse poolStateResponse = obj as PoolStateResponse;

            if (poolStateResponse == null)
            {
                return(false);
            }
            if (this.Info.Count != poolStateResponse.Info.Count)
            {
                return(false);
            }
            for (int i = 0; i < this.Info.Count; i++)
            {
                if (!this.Info[i].Equals(poolStateResponse.Info[i]))
                {
                    return(false);
                }
            }
            return(true);
        }
        public override bool Equals(object obj)
        {
            PoolStateResponse poolStateResponse = obj as PoolStateResponse;

            if (poolStateResponse == null)
            {
                return(false);
            }
            if (this.Info.get_Count() != poolStateResponse.Info.get_Count())
            {
                return(false);
            }
            for (int i = 0; i < this.Info.get_Count(); i++)
            {
                if (!this.Info.get_Item(i).Equals(poolStateResponse.Info.get_Item(i)))
                {
                    return(false);
                }
            }
            return(true);
        }
示例#9
0
 public void Deserialize(Stream stream)
 {
     PoolStateResponse.Deserialize(stream, this);
 }
示例#10
0
 public static PoolStateResponse Deserialize(Stream stream, PoolStateResponse instance)
 {
     return(PoolStateResponse.Deserialize(stream, instance, -1L));
 }