Beispiel #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");
 }
Beispiel #2
0
        public static ChallengePickedResponse DeserializeLengthDelimited(Stream stream)
        {
            ChallengePickedResponse challengePickedResponse = new ChallengePickedResponse();

            ChallengePickedResponse.DeserializeLengthDelimited(stream, challengePickedResponse);
            return(challengePickedResponse);
        }
Beispiel #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));
        }
Beispiel #4
0
 public static void Serialize(Stream stream, ChallengePickedResponse instance)
 {
     if (instance.HasData)
     {
         stream.WriteByte(10);
         ProtocolParser.WriteBytes(stream, instance.Data);
     }
 }
Beispiel #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);
        }
Beispiel #6
0
 public static ChallengePickedResponse Deserialize(Stream stream, ChallengePickedResponse instance)
 {
     return(ChallengePickedResponse.Deserialize(stream, instance, -1L));
 }
Beispiel #7
0
 public void Deserialize(Stream stream)
 {
     ChallengePickedResponse.Deserialize(stream, this);
 }
Beispiel #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)));
        }