public static ChallengeResultRequest DeserializeLengthDelimited(Stream stream, ChallengeResultRequest instance)
        {
            long num = (long)((ulong)ProtocolParser.ReadUInt32(stream));

            num += stream.Position;
            return(ChallengeResultRequest.Deserialize(stream, instance, num));
        }
        public static void Serialize(Stream stream, ChallengeResultRequest instance)
        {
            BinaryWriter binaryWriter = new BinaryWriter(stream);

            if (instance.HasId)
            {
                stream.WriteByte(8);
                ProtocolParser.WriteUInt32(stream, instance.Id);
            }
            if (instance.HasType)
            {
                stream.WriteByte(21);
                binaryWriter.Write(instance.Type);
            }
            if (instance.HasErrorId)
            {
                stream.WriteByte(24);
                ProtocolParser.WriteUInt32(stream, instance.ErrorId);
            }
            if (instance.HasAnswer)
            {
                stream.WriteByte(34);
                ProtocolParser.WriteBytes(stream, instance.Answer);
            }
        }
        public static ChallengeResultRequest DeserializeLengthDelimited(Stream stream)
        {
            ChallengeResultRequest challengeResultRequest = new ChallengeResultRequest();

            ChallengeResultRequest.DeserializeLengthDelimited(stream, challengeResultRequest);
            return(challengeResultRequest);
        }
        public override bool Equals(object obj)
        {
            ChallengeResultRequest challengeResultRequest = obj as ChallengeResultRequest;

            if (challengeResultRequest == null)
            {
                return(false);
            }
            if (this.HasId != challengeResultRequest.HasId || this.HasId && !this.Id.Equals(challengeResultRequest.Id))
            {
                return(false);
            }
            if (this.HasType != challengeResultRequest.HasType || this.HasType && !this.Type.Equals(challengeResultRequest.Type))
            {
                return(false);
            }
            if (this.HasErrorId != challengeResultRequest.HasErrorId || this.HasErrorId && !this.ErrorId.Equals(challengeResultRequest.ErrorId))
            {
                return(false);
            }
            if (this.HasAnswer == challengeResultRequest.HasAnswer && (!this.HasAnswer || this.Answer.Equals(challengeResultRequest.Answer)))
            {
                return(true);
            }
            return(false);
        }
        public static ChallengeResultRequest Deserialize(Stream stream, ChallengeResultRequest instance, long limit)
        {
            BinaryReader binaryReader = new BinaryReader(stream);

            while (limit < 0L || stream.Position < limit)
            {
                int num = stream.ReadByte();
                if (num == -1)
                {
                    if (limit >= 0L)
                    {
                        throw new EndOfStreamException();
                    }
                    return(instance);
                }
                else
                {
                    switch (num)
                    {
                    case 21:
                        instance.Type = binaryReader.ReadUInt32();
                        break;

                    default:
                        if (num != 8)
                        {
                            if (num != 34)
                            {
                                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.Answer = ProtocolParser.ReadBytes(stream);
                            }
                        }
                        else
                        {
                            instance.Id = ProtocolParser.ReadUInt32(stream);
                        }
                        break;

                    case 24:
                        instance.ErrorId = ProtocolParser.ReadUInt32(stream);
                        break;
                    }
                }
            }
            if (stream.Position == limit)
            {
                return(instance);
            }
            throw new ProtocolBufferException("Read past max limit");
        }
示例#6
0
        public static ChallengeResultRequest Deserialize(Stream stream, ChallengeResultRequest instance, long limit)
        {
            BinaryReader binaryReader = new BinaryReader(stream);

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

                    case 22:
                    case 23:
                    {
IL_73:
                        if (num2 == 8)
                        {
                            instance.Id = ProtocolParser.ReadUInt32(stream);
                            continue;
                        }
                        if (num2 == 34)
                        {
                            instance.Answer = ProtocolParser.ReadBytes(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 24:
                        instance.ErrorId = ProtocolParser.ReadUInt32(stream);
                        continue;
                    }
                    goto IL_73;
                }
                if (limit >= 0L)
                {
                    throw new EndOfStreamException();
                }
                return(instance);
            }
            if (stream.get_Position() == limit)
            {
                return(instance);
            }
            throw new ProtocolBufferException("Read past max limit");
        }
 public void Serialize(Stream stream)
 {
     ChallengeResultRequest.Serialize(stream, this);
 }
 public static ChallengeResultRequest Deserialize(Stream stream, ChallengeResultRequest instance)
 {
     return(ChallengeResultRequest.Deserialize(stream, instance, -1L));
 }
        public override bool Equals(object obj)
        {
            ChallengeResultRequest challengeResultRequest = obj as ChallengeResultRequest;

            return(challengeResultRequest != null && this.HasId == challengeResultRequest.HasId && (!this.HasId || this.Id.Equals(challengeResultRequest.Id)) && this.HasType == challengeResultRequest.HasType && (!this.HasType || this.Type.Equals(challengeResultRequest.Type)) && this.HasErrorId == challengeResultRequest.HasErrorId && (!this.HasErrorId || this.ErrorId.Equals(challengeResultRequest.ErrorId)) && this.HasAnswer == challengeResultRequest.HasAnswer && (!this.HasAnswer || this.Answer.Equals(challengeResultRequest.Answer)));
        }