public static UpdateChannelStateRequest DeserializeLengthDelimited(Stream stream)
        {
            UpdateChannelStateRequest updateChannelStateRequest = new UpdateChannelStateRequest();

            UpdateChannelStateRequest.DeserializeLengthDelimited(stream, updateChannelStateRequest);
            return(updateChannelStateRequest);
        }
        public static UpdateChannelStateRequest DeserializeLengthDelimited(Stream stream, UpdateChannelStateRequest instance)
        {
            long num = (long)((ulong)ProtocolParser.ReadUInt32(stream));

            num += stream.Position;
            return(UpdateChannelStateRequest.Deserialize(stream, instance, num));
        }
 public static UpdateChannelStateRequest Deserialize(Stream stream, UpdateChannelStateRequest 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.AgentId != null)
                 {
                     EntityId.DeserializeLengthDelimited(stream, instance.AgentId);
                 }
                 else
                 {
                     instance.AgentId = EntityId.DeserializeLengthDelimited(stream);
                 }
             }
             else if (num != 18)
             {
                 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.StateChange != null)
             {
                 ChannelState.DeserializeLengthDelimited(stream, instance.StateChange);
             }
             else
             {
                 instance.StateChange = ChannelState.DeserializeLengthDelimited(stream);
             }
         }
         else
         {
             if (stream.Position != limit)
             {
                 throw new ProtocolBufferException("Read past max limit");
             }
             break;
         }
     }
     return(instance);
 }
Exemplo n.º 4
0
 public static UpdateChannelStateRequest Deserialize(Stream stream, UpdateChannelStateRequest 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)
                 {
                     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.StateChange == null)
                 {
                     instance.StateChange = ChannelState.DeserializeLengthDelimited(stream);
                 }
                 else
                 {
                     ChannelState.DeserializeLengthDelimited(stream, instance.StateChange);
                 }
             }
             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 void Serialize(Stream stream, UpdateChannelStateRequest instance)
 {
     if (instance.HasAgentId)
     {
         stream.WriteByte(10);
         ProtocolParser.WriteUInt32(stream, instance.AgentId.GetSerializedSize());
         EntityId.Serialize(stream, instance.AgentId);
     }
     if (instance.StateChange == null)
     {
         throw new ArgumentNullException("StateChange", "Required by proto specification.");
     }
     stream.WriteByte(18);
     ProtocolParser.WriteUInt32(stream, instance.StateChange.GetSerializedSize());
     ChannelState.Serialize(stream, instance.StateChange);
 }
        public override bool Equals(object obj)
        {
            UpdateChannelStateRequest updateChannelStateRequest = obj as UpdateChannelStateRequest;

            if (updateChannelStateRequest == null)
            {
                return(false);
            }
            if (this.HasAgentId != updateChannelStateRequest.HasAgentId || this.HasAgentId && !this.AgentId.Equals(updateChannelStateRequest.AgentId))
            {
                return(false);
            }
            if (!this.StateChange.Equals(updateChannelStateRequest.StateChange))
            {
                return(false);
            }
            return(true);
        }
 public static UpdateChannelStateRequest Deserialize(Stream stream, UpdateChannelStateRequest instance)
 {
     return(UpdateChannelStateRequest.Deserialize(stream, instance, -1L));
 }
 public void Deserialize(Stream stream)
 {
     UpdateChannelStateRequest.Deserialize(stream, this);
 }
        public override bool Equals(object obj)
        {
            UpdateChannelStateRequest updateChannelStateRequest = obj as UpdateChannelStateRequest;

            return(updateChannelStateRequest != null && this.HasAgentId == updateChannelStateRequest.HasAgentId && (!this.HasAgentId || this.AgentId.Equals(updateChannelStateRequest.AgentId)) && this.StateChange.Equals(updateChannelStateRequest.StateChange));
        }