Esempio n. 1
0
 public void Deserialize(Stream stream)
 {
     ChallengeUserRequest.Deserialize(stream, this);
 }
 public static ChallengeUserRequest Deserialize(Stream stream, ChallengeUserRequest instance)
 {
     return(ChallengeUserRequest.Deserialize(stream, instance, -1L));
 }
        public static ChallengeUserRequest Deserialize(Stream stream, ChallengeUserRequest instance, long limit)
        {
            BinaryReader binaryReader = new BinaryReader(stream);

            if (instance.Challenges == null)
            {
                instance.Challenges = new List <Challenge>();
            }
            if (instance.Attributes == null)
            {
                instance.Attributes = new List <Attribute>();
            }
            while (limit < 0L || stream.get_Position() < limit)
            {
                int num = stream.ReadByte();
                if (num != -1)
                {
                    int num2 = num;
                    switch (num2)
                    {
                    case 21:
                        instance.Context = binaryReader.ReadUInt32();
                        continue;

                    case 22:
                    case 23:
                    {
IL_9F:
                        if (num2 == 10)
                        {
                            instance.Challenges.Add(Challenge.DeserializeLengthDelimited(stream));
                            continue;
                        }
                        if (num2 == 32)
                        {
                            instance.Deadline = ProtocolParser.ReadUInt64(stream);
                            continue;
                        }
                        if (num2 == 42)
                        {
                            instance.Attributes.Add(Attribute.DeserializeLengthDelimited(stream));
                            continue;
                        }
                        if (num2 == 50)
                        {
                            if (instance.GameAccountId == null)
                            {
                                instance.GameAccountId = EntityId.DeserializeLengthDelimited(stream);
                            }
                            else
                            {
                                EntityId.DeserializeLengthDelimited(stream, instance.GameAccountId);
                            }
                            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.Id = ProtocolParser.ReadUInt32(stream);
                        continue;
                    }
                    goto IL_9F;
                }
                if (limit >= 0L)
                {
                    throw new EndOfStreamException();
                }
                return(instance);
            }
            if (stream.get_Position() == limit)
            {
                return(instance);
            }
            throw new ProtocolBufferException("Read past max limit");
        }
        public static ChallengeUserRequest Deserialize(Stream stream, ChallengeUserRequest instance, long limit)
        {
            BinaryReader binaryReader = new BinaryReader(stream);

            if (instance.Challenges == null)
            {
                instance.Challenges = new List <Challenge>();
            }
            if (instance.Attributes == null)
            {
                instance.Attributes = new List <bnet.protocol.attribute.Attribute>();
            }
            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.Context = binaryReader.ReadUInt32();
                        break;

                    default:
                        if (num != 10)
                        {
                            if (num != 32)
                            {
                                if (num != 42)
                                {
                                    if (num != 50)
                                    {
                                        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 if (instance.GameAccountId == null)
                                    {
                                        instance.GameAccountId = EntityId.DeserializeLengthDelimited(stream);
                                    }
                                    else
                                    {
                                        EntityId.DeserializeLengthDelimited(stream, instance.GameAccountId);
                                    }
                                }
                                else
                                {
                                    instance.Attributes.Add(bnet.protocol.attribute.Attribute.DeserializeLengthDelimited(stream));
                                }
                            }
                            else
                            {
                                instance.Deadline = ProtocolParser.ReadUInt64(stream);
                            }
                        }
                        else
                        {
                            instance.Challenges.Add(Challenge.DeserializeLengthDelimited(stream));
                        }
                        break;

                    case 24:
                        instance.Id = ProtocolParser.ReadUInt32(stream);
                        break;
                    }
                }
            }
            if (stream.Position == limit)
            {
                return(instance);
            }
            throw new ProtocolBufferException("Read past max limit");
        }