Exemple #1
0
        public static ChallengeAnsweredRequest DeserializeLengthDelimited(Stream stream, ChallengeAnsweredRequest instance)
        {
            long num = (long)((ulong)ProtocolParser.ReadUInt32(stream));

            num += stream.Position;
            return(ChallengeAnsweredRequest.Deserialize(stream, instance, num));
        }
Exemple #2
0
        public static ChallengeAnsweredRequest DeserializeLengthDelimited(Stream stream)
        {
            ChallengeAnsweredRequest challengeAnsweredRequest = new ChallengeAnsweredRequest();

            ChallengeAnsweredRequest.DeserializeLengthDelimited(stream, challengeAnsweredRequest);
            return(challengeAnsweredRequest);
        }
Exemple #3
0
 public static ChallengeAnsweredRequest Deserialize(Stream stream, ChallengeAnsweredRequest 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 != 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.Id = ProtocolParser.ReadUInt32(stream);
                     }
                 }
                 else
                 {
                     instance.Data = ProtocolParser.ReadBytes(stream);
                 }
             }
             else
             {
                 instance.Answer = ProtocolParser.ReadString(stream);
             }
         }
     }
     if (stream.get_Position() == limit)
     {
         return(instance);
     }
     throw new ProtocolBufferException("Read past max limit");
 }
Exemple #4
0
 public static ChallengeAnsweredRequest Deserialize(Stream stream, ChallengeAnsweredRequest 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.Answer = ProtocolParser.ReadString(stream);
             }
             else if (num == 18)
             {
                 instance.Data = ProtocolParser.ReadBytes(stream);
             }
             else if (num == 24)
             {
                 instance.Id = ProtocolParser.ReadUInt32(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 #5
0
 public static void Serialize(Stream stream, ChallengeAnsweredRequest instance)
 {
     if (instance.Answer == null)
     {
         throw new ArgumentNullException("Answer", "Required by proto specification.");
     }
     stream.WriteByte(10);
     ProtocolParser.WriteBytes(stream, Encoding.UTF8.GetBytes(instance.Answer));
     if (instance.HasData)
     {
         stream.WriteByte(18);
         ProtocolParser.WriteBytes(stream, instance.Data);
     }
     if (instance.HasId)
     {
         stream.WriteByte(24);
         ProtocolParser.WriteUInt32(stream, instance.Id);
     }
 }
Exemple #6
0
        public override bool Equals(object obj)
        {
            ChallengeAnsweredRequest challengeAnsweredRequest = obj as ChallengeAnsweredRequest;

            if (challengeAnsweredRequest == null)
            {
                return(false);
            }
            if (!this.Answer.Equals(challengeAnsweredRequest.Answer))
            {
                return(false);
            }
            if (this.HasData != challengeAnsweredRequest.HasData || this.HasData && !this.Data.Equals(challengeAnsweredRequest.Data))
            {
                return(false);
            }
            if (this.HasId == challengeAnsweredRequest.HasId && (!this.HasId || this.Id.Equals(challengeAnsweredRequest.Id)))
            {
                return(true);
            }
            return(false);
        }
Exemple #7
0
 public static ChallengeAnsweredRequest Deserialize(Stream stream, ChallengeAnsweredRequest instance)
 {
     return(ChallengeAnsweredRequest.Deserialize(stream, instance, -1L));
 }
Exemple #8
0
 public void Deserialize(Stream stream)
 {
     ChallengeAnsweredRequest.Deserialize(stream, this);
 }
Exemple #9
0
        public override bool Equals(object obj)
        {
            ChallengeAnsweredRequest challengeAnsweredRequest = obj as ChallengeAnsweredRequest;

            return(challengeAnsweredRequest != null && this.Answer.Equals(challengeAnsweredRequest.Answer) && this.HasData == challengeAnsweredRequest.HasData && (!this.HasData || this.Data.Equals(challengeAnsweredRequest.Data)) && this.HasId == challengeAnsweredRequest.HasId && (!this.HasId || this.Id.Equals(challengeAnsweredRequest.Id)));
        }