Example #1
0
        public static ChallengeAnsweredResponse DeserializeLengthDelimited(Stream stream, ChallengeAnsweredResponse instance)
        {
            long position = (long)ProtocolParser.ReadUInt32(stream);

            position += stream.Position;
            return(ChallengeAnsweredResponse.Deserialize(stream, instance, position));
        }
Example #2
0
        public static ChallengeAnsweredResponse DeserializeLengthDelimited(Stream stream)
        {
            ChallengeAnsweredResponse challengeAnsweredResponse = new ChallengeAnsweredResponse();

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

            num += stream.get_Position();
            return(ChallengeAnsweredResponse.Deserialize(stream, instance, num));
        }
 public static ChallengeAnsweredResponse Deserialize(Stream stream, ChallengeAnsweredResponse 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 != 16)
                 {
                     if (num2 != 24)
                     {
                         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.RecordNotFound = ProtocolParser.ReadBool(stream);
                     }
                 }
                 else
                 {
                     instance.DoRetry = ProtocolParser.ReadBool(stream);
                 }
             }
             else
             {
                 instance.Data = ProtocolParser.ReadBytes(stream);
             }
         }
     }
     if (stream.get_Position() == limit)
     {
         return(instance);
     }
     throw new ProtocolBufferException("Read past max limit");
 }
Example #5
0
 public static ChallengeAnsweredResponse Deserialize(Stream stream, ChallengeAnsweredResponse 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.Data = ProtocolParser.ReadBytes(stream);
             }
             else if (num == 16)
             {
                 instance.DoRetry = ProtocolParser.ReadBool(stream);
             }
             else if (num == 24)
             {
                 instance.RecordNotFound = ProtocolParser.ReadBool(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);
 }
Example #6
0
 public static void Serialize(Stream stream, ChallengeAnsweredResponse instance)
 {
     if (instance.HasData)
     {
         stream.WriteByte(10);
         ProtocolParser.WriteBytes(stream, instance.Data);
     }
     if (instance.HasDoRetry)
     {
         stream.WriteByte(16);
         ProtocolParser.WriteBool(stream, instance.DoRetry);
     }
     if (instance.HasRecordNotFound)
     {
         stream.WriteByte(24);
         ProtocolParser.WriteBool(stream, instance.RecordNotFound);
     }
 }
Example #7
0
        public override bool Equals(object obj)
        {
            ChallengeAnsweredResponse challengeAnsweredResponse = obj as ChallengeAnsweredResponse;

            if (challengeAnsweredResponse == null)
            {
                return(false);
            }
            if (this.HasData != challengeAnsweredResponse.HasData || this.HasData && !this.Data.Equals(challengeAnsweredResponse.Data))
            {
                return(false);
            }
            if (this.HasDoRetry != challengeAnsweredResponse.HasDoRetry || this.HasDoRetry && !this.DoRetry.Equals(challengeAnsweredResponse.DoRetry))
            {
                return(false);
            }
            if (this.HasRecordNotFound == challengeAnsweredResponse.HasRecordNotFound && (!this.HasRecordNotFound || this.RecordNotFound.Equals(challengeAnsweredResponse.RecordNotFound)))
            {
                return(true);
            }
            return(false);
        }
Example #8
0
 public static ChallengeAnsweredResponse Deserialize(Stream stream, ChallengeAnsweredResponse instance)
 {
     return(ChallengeAnsweredResponse.Deserialize(stream, instance, (long)-1));
 }
Example #9
0
 public void Deserialize(Stream stream)
 {
     ChallengeAnsweredResponse.Deserialize(stream, this);
 }
Example #10
0
        public override bool Equals(object obj)
        {
            ChallengeAnsweredResponse challengeAnsweredResponse = obj as ChallengeAnsweredResponse;

            return(challengeAnsweredResponse != null && this.HasData == challengeAnsweredResponse.HasData && (!this.HasData || this.Data.Equals(challengeAnsweredResponse.Data)) && this.HasDoRetry == challengeAnsweredResponse.HasDoRetry && (!this.HasDoRetry || this.DoRetry.Equals(challengeAnsweredResponse.DoRetry)) && this.HasRecordNotFound == challengeAnsweredResponse.HasRecordNotFound && (!this.HasRecordNotFound || this.RecordNotFound.Equals(challengeAnsweredResponse.RecordNotFound)));
        }