Exemple #1
0
 public static ChallengePickedResponse Deserialize(Stream stream, ChallengePickedResponse instance, long limit)
 {
     while (limit < 0L || stream.Position < limit)
     {
         int num = stream.ReadByte();
         if (num == -1)
         {
             if (limit >= 0L)
             {
                 throw new EndOfStreamException();
             }
             return(instance);
         }
         else if (num != 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
         {
             instance.Data = ProtocolParser.ReadBytes(stream);
         }
     }
     if (stream.Position == limit)
     {
         return(instance);
     }
     throw new ProtocolBufferException("Read past max limit");
 }
Exemple #2
0
        public static ChallengePickedResponse DeserializeLengthDelimited(Stream stream)
        {
            ChallengePickedResponse challengePickedResponse = new ChallengePickedResponse();

            ChallengePickedResponse.DeserializeLengthDelimited(stream, challengePickedResponse);
            return(challengePickedResponse);
        }
Exemple #3
0
        public static ChallengePickedResponse DeserializeLengthDelimited(Stream stream, ChallengePickedResponse instance)
        {
            long num = (long)((ulong)ProtocolParser.ReadUInt32(stream));

            num += stream.Position;
            return(ChallengePickedResponse.Deserialize(stream, instance, num));
        }
Exemple #4
0
 public static void Serialize(Stream stream, ChallengePickedResponse instance)
 {
     if (instance.HasData)
     {
         stream.WriteByte(10);
         ProtocolParser.WriteBytes(stream, instance.Data);
     }
 }
Exemple #5
0
        public override bool Equals(object obj)
        {
            ChallengePickedResponse challengePickedResponse = obj as ChallengePickedResponse;

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

            return(challengePickedResponse != null && this.HasData == challengePickedResponse.HasData && (!this.HasData || this.Data.Equals(challengePickedResponse.Data)));
        }