public static ChallengePickedRequest DeserializeLengthDelimited(Stream stream)
        {
            ChallengePickedRequest challengePickedRequest = new ChallengePickedRequest();

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

            num += stream.get_Position();
            return(ChallengePickedRequest.Deserialize(stream, instance, num));
        }
        public static ChallengePickedRequest DeserializeLengthDelimited(Stream stream, ChallengePickedRequest instance)
        {
            long position = (long)ProtocolParser.ReadUInt32(stream);

            position += stream.Position;
            return(ChallengePickedRequest.Deserialize(stream, instance, position));
        }
        public static ChallengePickedRequest Deserialize(Stream stream, ChallengePickedRequest instance, long limit)
        {
            BinaryReader binaryReader = new BinaryReader(stream);

            instance.NewChallengeProtocol = false;
            while (limit < 0L || stream.get_Position() < limit)
            {
                int num = stream.ReadByte();
                if (num != -1)
                {
                    int num2 = num;
                    switch (num2)
                    {
                    case 13:
                        instance.Challenge = binaryReader.ReadUInt32();
                        continue;

                    case 14:
                    case 15:
                    {
IL_7A:
                        if (num2 == 24)
                        {
                            instance.NewChallengeProtocol = ProtocolParser.ReadBool(stream);
                            continue;
                        }
                        Key  key   = ProtocolParser.ReadKey((byte)num, stream);
                        uint field = key.Field;
                        if (field != 0u)
                        {
                            ProtocolParser.SkipKey(stream, key);
                            continue;
                        }
                        throw new ProtocolBufferException("Invalid field id: 0, something went wrong in the stream");
                    }

                    case 16:
                        instance.Id = ProtocolParser.ReadUInt32(stream);
                        continue;
                    }
                    goto IL_7A;
                }
                if (limit >= 0L)
                {
                    throw new EndOfStreamException();
                }
                return(instance);
            }
            if (stream.get_Position() == limit)
            {
                return(instance);
            }
            throw new ProtocolBufferException("Read past max limit");
        }
Beispiel #5
0
        public static ChallengePickedRequest Deserialize(Stream stream, ChallengePickedRequest instance, long limit)
        {
            BinaryReader binaryReader = new BinaryReader(stream);

            instance.NewChallengeProtocol = false;
            while (limit < 0L || stream.Position < limit)
            {
                int num = stream.ReadByte();
                if (num == -1)
                {
                    if (limit >= 0L)
                    {
                        throw new EndOfStreamException();
                    }
                    return(instance);
                }
                else if (num != 13)
                {
                    if (num != 16)
                    {
                        if (num != 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.NewChallengeProtocol = ProtocolParser.ReadBool(stream);
                        }
                    }
                    else
                    {
                        instance.Id = ProtocolParser.ReadUInt32(stream);
                    }
                }
                else
                {
                    instance.Challenge = binaryReader.ReadUInt32();
                }
            }
            if (stream.Position == limit)
            {
                return(instance);
            }
            throw new ProtocolBufferException("Read past max limit");
        }
        public static void Serialize(Stream stream, ChallengePickedRequest instance)
        {
            BinaryWriter binaryWriter = new BinaryWriter(stream);

            stream.WriteByte(13);
            binaryWriter.Write(instance.Challenge);
            if (instance.HasId)
            {
                stream.WriteByte(16);
                ProtocolParser.WriteUInt32(stream, instance.Id);
            }
            if (instance.HasNewChallengeProtocol)
            {
                stream.WriteByte(24);
                ProtocolParser.WriteBool(stream, instance.NewChallengeProtocol);
            }
        }
        public override bool Equals(object obj)
        {
            ChallengePickedRequest challengePickedRequest = obj as ChallengePickedRequest;

            if (challengePickedRequest == null)
            {
                return(false);
            }
            if (!this.Challenge.Equals(challengePickedRequest.Challenge))
            {
                return(false);
            }
            if (this.HasId != challengePickedRequest.HasId || this.HasId && !this.Id.Equals(challengePickedRequest.Id))
            {
                return(false);
            }
            if (this.HasNewChallengeProtocol == challengePickedRequest.HasNewChallengeProtocol && (!this.HasNewChallengeProtocol || this.NewChallengeProtocol.Equals(challengePickedRequest.NewChallengeProtocol)))
            {
                return(true);
            }
            return(false);
        }
 public static ChallengePickedRequest Deserialize(Stream stream, ChallengePickedRequest instance)
 {
     return(ChallengePickedRequest.Deserialize(stream, instance, -1L));
 }
 public void Deserialize(Stream stream)
 {
     ChallengePickedRequest.Deserialize(stream, this);
 }
        public override bool Equals(object obj)
        {
            ChallengePickedRequest challengePickedRequest = obj as ChallengePickedRequest;

            return(challengePickedRequest != null && this.Challenge.Equals(challengePickedRequest.Challenge) && this.HasId == challengePickedRequest.HasId && (!this.HasId || this.Id.Equals(challengePickedRequest.Id)) && this.HasNewChallengeProtocol == challengePickedRequest.HasNewChallengeProtocol && (!this.HasNewChallengeProtocol || this.NewChallengeProtocol.Equals(challengePickedRequest.NewChallengeProtocol)));
        }