예제 #1
0
        public static ProgramTag DeserializeLengthDelimited(Stream stream)
        {
            ProgramTag programTag = new ProgramTag();

            ProgramTag.DeserializeLengthDelimited(stream, programTag);
            return(programTag);
        }
예제 #2
0
        public static AccountFieldTags Deserialize(Stream stream, AccountFieldTags instance, long limit)
        {
            BinaryReader binaryReader = new BinaryReader(stream);

            if (instance.GameLevelInfoTags == null)
            {
                instance.GameLevelInfoTags = new List <ProgramTag>();
            }
            if (instance.GameStatusTags == null)
            {
                instance.GameStatusTags = new List <ProgramTag>();
            }
            if (instance.GameAccountTags == null)
            {
                instance.GameAccountTags = new List <RegionTag>();
            }
            while (limit < 0L || stream.Position < limit)
            {
                int num = stream.ReadByte();
                if (num == -1)
                {
                    if (limit >= 0L)
                    {
                        throw new EndOfStreamException();
                    }
                    return(instance);
                }
                else if (num != 21)
                {
                    if (num != 29)
                    {
                        if (num != 37)
                        {
                            if (num != 58)
                            {
                                if (num != 74)
                                {
                                    if (num != 90)
                                    {
                                        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.GameAccountTags.Add(RegionTag.DeserializeLengthDelimited(stream));
                                    }
                                }
                                else
                                {
                                    instance.GameStatusTags.Add(ProgramTag.DeserializeLengthDelimited(stream));
                                }
                            }
                            else
                            {
                                instance.GameLevelInfoTags.Add(ProgramTag.DeserializeLengthDelimited(stream));
                            }
                        }
                        else
                        {
                            instance.ParentalControlInfoTag = binaryReader.ReadUInt32();
                        }
                    }
                    else
                    {
                        instance.PrivacyInfoTag = binaryReader.ReadUInt32();
                    }
                }
                else
                {
                    instance.AccountLevelInfoTag = binaryReader.ReadUInt32();
                }
            }
            if (stream.Position == limit)
            {
                return(instance);
            }
            throw new ProtocolBufferException("Read past max limit");
        }