Exemple #1
0
        public static ChallengeExternalRequest DeserializeLengthDelimited(Stream stream)
        {
            ChallengeExternalRequest challengeExternalRequest = new ChallengeExternalRequest();

            ChallengeExternalRequest.DeserializeLengthDelimited(stream, challengeExternalRequest);
            return(challengeExternalRequest);
        }
Exemple #2
0
        public static ChallengeExternalRequest DeserializeLengthDelimited(Stream stream, ChallengeExternalRequest instance)
        {
            long num = (long)((ulong)ProtocolParser.ReadUInt32(stream));

            num += stream.get_Position();
            return(ChallengeExternalRequest.Deserialize(stream, instance, num));
        }
Exemple #3
0
        public static ChallengeExternalRequest DeserializeLengthDelimited(Stream stream, ChallengeExternalRequest instance)
        {
            long position = (long)ProtocolParser.ReadUInt32(stream);

            position += stream.Position;
            return(ChallengeExternalRequest.Deserialize(stream, instance, position));
        }
Exemple #4
0
 public static ChallengeExternalRequest Deserialize(Stream stream, ChallengeExternalRequest 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 != 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
                     {
                         instance.Payload = ProtocolParser.ReadBytes(stream);
                     }
                 }
                 else
                 {
                     instance.PayloadType = ProtocolParser.ReadString(stream);
                 }
             }
             else
             {
                 instance.RequestToken = ProtocolParser.ReadString(stream);
             }
         }
     }
     if (stream.get_Position() == limit)
     {
         return(instance);
     }
     throw new ProtocolBufferException("Read past max limit");
 }
Exemple #5
0
 public static ChallengeExternalRequest Deserialize(Stream stream, ChallengeExternalRequest 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)
             {
                 instance.RequestToken = ProtocolParser.ReadString(stream);
             }
             else if (num == 18)
             {
                 instance.PayloadType = ProtocolParser.ReadString(stream);
             }
             else if (num == 26)
             {
                 instance.Payload = ProtocolParser.ReadBytes(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);
 }
Exemple #6
0
 public static void Serialize(Stream stream, ChallengeExternalRequest instance)
 {
     if (instance.HasRequestToken)
     {
         stream.WriteByte(10);
         ProtocolParser.WriteBytes(stream, Encoding.get_UTF8().GetBytes(instance.RequestToken));
     }
     if (instance.HasPayloadType)
     {
         stream.WriteByte(18);
         ProtocolParser.WriteBytes(stream, Encoding.get_UTF8().GetBytes(instance.PayloadType));
     }
     if (instance.HasPayload)
     {
         stream.WriteByte(26);
         ProtocolParser.WriteBytes(stream, instance.Payload);
     }
 }
Exemple #7
0
        public override bool Equals(object obj)
        {
            ChallengeExternalRequest challengeExternalRequest = obj as ChallengeExternalRequest;

            if (challengeExternalRequest == null)
            {
                return(false);
            }
            if (this.HasRequestToken != challengeExternalRequest.HasRequestToken || this.HasRequestToken && !this.RequestToken.Equals(challengeExternalRequest.RequestToken))
            {
                return(false);
            }
            if (this.HasPayloadType != challengeExternalRequest.HasPayloadType || this.HasPayloadType && !this.PayloadType.Equals(challengeExternalRequest.PayloadType))
            {
                return(false);
            }
            if (this.HasPayload == challengeExternalRequest.HasPayload && (!this.HasPayload || this.Payload.Equals(challengeExternalRequest.Payload)))
            {
                return(true);
            }
            return(false);
        }
Exemple #8
0
 public static ChallengeExternalRequest Deserialize(Stream stream, ChallengeExternalRequest instance)
 {
     return(ChallengeExternalRequest.Deserialize(stream, instance, -1L));
 }
Exemple #9
0
 public void Deserialize(Stream stream)
 {
     ChallengeExternalRequest.Deserialize(stream, this);
 }
Exemple #10
0
        public override bool Equals(object obj)
        {
            ChallengeExternalRequest challengeExternalRequest = obj as ChallengeExternalRequest;

            return(challengeExternalRequest != null && this.HasRequestToken == challengeExternalRequest.HasRequestToken && (!this.HasRequestToken || this.RequestToken.Equals(challengeExternalRequest.RequestToken)) && this.HasPayloadType == challengeExternalRequest.HasPayloadType && (!this.HasPayloadType || this.PayloadType.Equals(challengeExternalRequest.PayloadType)) && this.HasPayload == challengeExternalRequest.HasPayload && (!this.HasPayload || this.Payload.Equals(challengeExternalRequest.Payload)));
        }