public static Member DeserializeLengthDelimited(Stream stream)
        {
            Member member = new Member();

            Member.DeserializeLengthDelimited(stream, member);
            return(member);
        }
 public static JoinNotification Deserialize(Stream stream, JoinNotification 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)
             {
                 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 if (instance.Member == null)
             {
                 instance.Member = Member.DeserializeLengthDelimited(stream);
             }
             else
             {
                 Member.DeserializeLengthDelimited(stream, instance.Member);
             }
         }
     }
     if (stream.get_Position() == limit)
     {
         return(instance);
     }
     throw new ProtocolBufferException("Read past max limit");
 }
Exemple #3
0
 public static UpdateMemberStateRequest Deserialize(Stream stream, UpdateMemberStateRequest instance, long limit)
 {
     if (instance.StateChange == null)
     {
         instance.StateChange = new List <Member>();
     }
     if (instance.RemovedRole == null)
     {
         instance.RemovedRole = new List <uint>();
     }
     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 != 26)
                     {
                         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
                     {
                         long num3 = (long)((ulong)ProtocolParser.ReadUInt32(stream));
                         num3 += stream.get_Position();
                         while (stream.get_Position() < num3)
                         {
                             instance.RemovedRole.Add(ProtocolParser.ReadUInt32(stream));
                         }
                         if (stream.get_Position() != num3)
                         {
                             throw new ProtocolBufferException("Read too many bytes in packed data");
                         }
                     }
                 }
                 else
                 {
                     instance.StateChange.Add(Member.DeserializeLengthDelimited(stream));
                 }
             }
             else if (instance.AgentId == null)
             {
                 instance.AgentId = EntityId.DeserializeLengthDelimited(stream);
             }
             else
             {
                 EntityId.DeserializeLengthDelimited(stream, instance.AgentId);
             }
         }
     }
     if (stream.get_Position() == limit)
     {
         return(instance);
     }
     throw new ProtocolBufferException("Read past max limit");
 }
 public static UpdateMemberStateRequest Deserialize(Stream stream, UpdateMemberStateRequest instance, long limit)
 {
     if (instance.StateChange == null)
     {
         instance.StateChange = new List <Member>();
     }
     if (instance.RemovedRole == null)
     {
         instance.RemovedRole = new List <uint>();
     }
     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.AgentId != null)
                 {
                     EntityId.DeserializeLengthDelimited(stream, instance.AgentId);
                 }
                 else
                 {
                     instance.AgentId = EntityId.DeserializeLengthDelimited(stream);
                 }
             }
             else if (num == 18)
             {
                 instance.StateChange.Add(Member.DeserializeLengthDelimited(stream));
             }
             else if (num == 26)
             {
                 long position = (long)ProtocolParser.ReadUInt32(stream);
                 position += stream.Position;
                 while (stream.Position < position)
                 {
                     instance.RemovedRole.Add(ProtocolParser.ReadUInt32(stream));
                 }
                 if (stream.Position != position)
                 {
                     throw new ProtocolBufferException("Read too many bytes in packed data");
                 }
             }
             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);
 }