public static ObjectAddress DeserializeLengthDelimited(Stream stream)
        {
            ObjectAddress objectAddress = new ObjectAddress();

            ObjectAddress.DeserializeLengthDelimited(stream, objectAddress);
            return(objectAddress);
        }
Esempio n. 2
0
 public static ErrorInfo Deserialize(Stream stream, ErrorInfo instance, long limit)
 {
     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 != 16)
             {
                 if (num != 24)
                 {
                     if (num != 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.MethodId = ProtocolParser.ReadUInt32(stream);
                     }
                 }
                 else
                 {
                     instance.ServiceHash = ProtocolParser.ReadUInt32(stream);
                 }
             }
             else
             {
                 instance.Status = ProtocolParser.ReadUInt32(stream);
             }
         }
         else if (instance.ObjectAddress == null)
         {
             instance.ObjectAddress = ObjectAddress.DeserializeLengthDelimited(stream);
         }
         else
         {
             ObjectAddress.DeserializeLengthDelimited(stream, instance.ObjectAddress);
         }
     }
     if (stream.Position == limit)
     {
         return(instance);
     }
     throw new ProtocolBufferException("Read past max limit");
 }