public static GameAccountLink DeserializeLengthDelimited(Stream stream)
        {
            GameAccountLink gameAccountLink = new GameAccountLink();

            GameAccountLink.DeserializeLengthDelimited(stream, gameAccountLink);
            return(gameAccountLink);
        }
Esempio n. 2
0
 public static GetAccountResponse Deserialize(Stream stream, GetAccountResponse instance, long limit)
 {
     if (instance.Email == null)
     {
         instance.Email = new List <string>();
     }
     if (instance.Links == null)
     {
         instance.Links = new List <GameAccountLink>();
     }
     while (limit < 0L || stream.get_Position() < limit)
     {
         int num = stream.ReadByte();
         if (num == -1)
         {
             if (limit >= 0L)
             {
                 throw new EndOfStreamException();
             }
             return(instance);
         }
         else
         {
             int num2 = num;
             if (num2 != 90)
             {
                 if (num2 != 98)
                 {
                     if (num2 != 106)
                     {
                         if (num2 != 114)
                         {
                             if (num2 != 122)
                             {
                                 Key  key   = ProtocolParser.ReadKey((byte)num, stream);
                                 uint field = key.Field;
                                 if (field != 16u)
                                 {
                                     if (field != 17u)
                                     {
                                         if (field == 0u)
                                         {
                                             throw new ProtocolBufferException("Invalid field id: 0, something went wrong in the stream");
                                         }
                                         ProtocolParser.SkipKey(stream, key);
                                     }
                                     else if (key.WireType == Wire.LengthDelimited)
                                     {
                                         if (instance.ParentalControlInfo == null)
                                         {
                                             instance.ParentalControlInfo = ParentalControlInfo.DeserializeLengthDelimited(stream);
                                         }
                                         else
                                         {
                                             ParentalControlInfo.DeserializeLengthDelimited(stream, instance.ParentalControlInfo);
                                         }
                                     }
                                 }
                                 else if (key.WireType == Wire.LengthDelimited)
                                 {
                                     instance.Links.Add(GameAccountLink.DeserializeLengthDelimited(stream));
                                 }
                             }
                             else
                             {
                                 instance.FullName = ProtocolParser.ReadString(stream);
                             }
                         }
                         else
                         {
                             instance.BattleTag = ProtocolParser.ReadString(stream);
                         }
                     }
                     else
                     {
                         instance.Email.Add(ProtocolParser.ReadString(stream));
                     }
                 }
                 else if (instance.Id == null)
                 {
                     instance.Id = AccountId.DeserializeLengthDelimited(stream);
                 }
                 else
                 {
                     AccountId.DeserializeLengthDelimited(stream, instance.Id);
                 }
             }
             else if (instance.Blob == null)
             {
                 instance.Blob = AccountBlob.DeserializeLengthDelimited(stream);
             }
             else
             {
                 AccountBlob.DeserializeLengthDelimited(stream, instance.Blob);
             }
         }
     }
     if (stream.get_Position() == limit)
     {
         return(instance);
     }
     throw new ProtocolBufferException("Read past max limit");
 }
Esempio n. 3
0
        public static AccountBlob Deserialize(Stream stream, AccountBlob instance, long limit)
        {
            BinaryReader binaryReader = new BinaryReader(stream);

            if (instance.Email == null)
            {
                instance.Email = new List <string>();
            }
            if (instance.Licenses == null)
            {
                instance.Licenses = new List <AccountLicense>();
            }
            if (instance.Credentials == null)
            {
                instance.Credentials = new List <AccountCredential>();
            }
            if (instance.AccountLinks == null)
            {
                instance.AccountLinks = new List <GameAccountLink>();
            }
            while (true)
            {
                if (limit < (long)0 || stream.Position < limit)
                {
                    int num = stream.ReadByte();
                    if (num != -1)
                    {
                        switch (num)
                        {
                        case 21:
                        {
                            instance.Id = binaryReader.ReadUInt32();
                            continue;
                        }

                        case 24:
                        {
                            instance.Region = ProtocolParser.ReadUInt32(stream);
                            continue;
                        }

                        default:
                        {
                            if (num == 34)
                            {
                                instance.Email.Add(ProtocolParser.ReadString(stream));
                                continue;
                            }
                            else if (num == 40)
                            {
                                instance.Flags = ProtocolParser.ReadUInt64(stream);
                                continue;
                            }
                            else if (num == 48)
                            {
                                instance.SecureRelease = ProtocolParser.ReadUInt64(stream);
                                continue;
                            }
                            else if (num == 56)
                            {
                                instance.WhitelistStart = ProtocolParser.ReadUInt64(stream);
                                continue;
                            }
                            else if (num == 64)
                            {
                                instance.WhitelistEnd = ProtocolParser.ReadUInt64(stream);
                                continue;
                            }
                            else if (num == 82)
                            {
                                instance.FullName = ProtocolParser.ReadString(stream);
                                continue;
                            }
                            else
                            {
                                Key  key   = ProtocolParser.ReadKey((byte)num, stream);
                                uint field = key.Field;
                                switch (field)
                                {
                                case 20:
                                {
                                    if (key.WireType == Wire.LengthDelimited)
                                    {
                                        instance.Licenses.Add(AccountLicense.DeserializeLengthDelimited(stream));
                                        continue;
                                    }
                                    else
                                    {
                                        break;
                                    }
                                }

                                case 21:
                                {
                                    if (key.WireType == Wire.LengthDelimited)
                                    {
                                        instance.Credentials.Add(AccountCredential.DeserializeLengthDelimited(stream));
                                        continue;
                                    }
                                    else
                                    {
                                        break;
                                    }
                                }

                                case 22:
                                {
                                    if (key.WireType == Wire.LengthDelimited)
                                    {
                                        instance.AccountLinks.Add(GameAccountLink.DeserializeLengthDelimited(stream));
                                        continue;
                                    }
                                    else
                                    {
                                        break;
                                    }
                                }

                                case 23:
                                {
                                    if (key.WireType == Wire.LengthDelimited)
                                    {
                                        instance.BattleTag = ProtocolParser.ReadString(stream);
                                        continue;
                                    }
                                    else
                                    {
                                        break;
                                    }
                                }

                                case 25:
                                {
                                    if (key.WireType == Wire.Fixed32)
                                    {
                                        instance.DefaultCurrency = binaryReader.ReadUInt32();
                                        continue;
                                    }
                                    else
                                    {
                                        break;
                                    }
                                }

                                case 26:
                                {
                                    if (key.WireType == Wire.Varint)
                                    {
                                        instance.LegalRegion = ProtocolParser.ReadUInt32(stream);
                                        continue;
                                    }
                                    else
                                    {
                                        break;
                                    }
                                }

                                case 27:
                                {
                                    if (key.WireType == Wire.Fixed32)
                                    {
                                        instance.LegalLocale = binaryReader.ReadUInt32();
                                        continue;
                                    }
                                    else
                                    {
                                        break;
                                    }
                                }

                                case 30:
                                {
                                    if (key.WireType == Wire.Varint)
                                    {
                                        instance.CacheExpiration = ProtocolParser.ReadUInt64(stream);
                                        continue;
                                    }
                                    else
                                    {
                                        break;
                                    }
                                }

                                case 31:
                                {
                                    if (key.WireType == Wire.LengthDelimited)
                                    {
                                        if (instance.ParentalControlInfo != null)
                                        {
                                            bnet.protocol.account.ParentalControlInfo.DeserializeLengthDelimited(stream, instance.ParentalControlInfo);
                                        }
                                        else
                                        {
                                            instance.ParentalControlInfo = bnet.protocol.account.ParentalControlInfo.DeserializeLengthDelimited(stream);
                                        }
                                        continue;
                                    }
                                    else
                                    {
                                        break;
                                    }
                                }

                                case 32:
                                {
                                    if (key.WireType == Wire.LengthDelimited)
                                    {
                                        instance.Country = ProtocolParser.ReadString(stream);
                                        continue;
                                    }
                                    else
                                    {
                                        break;
                                    }
                                }

                                case 33:
                                {
                                    if (key.WireType == Wire.Varint)
                                    {
                                        instance.PreferredRegion = ProtocolParser.ReadUInt32(stream);
                                        continue;
                                    }
                                    else
                                    {
                                        break;
                                    }
                                }

                                default:
                                {
                                    if (field == 0)
                                    {
                                        throw new ProtocolBufferException("Invalid field id: 0, something went wrong in the stream");
                                    }
                                    ProtocolParser.SkipKey(stream, key);
                                    break;
                                }
                                }
                                continue;
                            }
                        }
                        }
                    }
                    else
                    {
                        if (limit >= (long)0)
                        {
                            throw new EndOfStreamException();
                        }
                        break;
                    }
                }
                else
                {
                    if (stream.Position != limit)
                    {
                        throw new ProtocolBufferException("Read past max limit");
                    }
                    break;
                }
            }
            return(instance);
        }
Esempio n. 4
0
        public static AccountBlob Deserialize(Stream stream, AccountBlob instance, long limit)
        {
            BinaryReader binaryReader = new BinaryReader(stream);

            if (instance.Email == null)
            {
                instance.Email = new List <string>();
            }
            if (instance.Licenses == null)
            {
                instance.Licenses = new List <AccountLicense>();
            }
            if (instance.Credentials == null)
            {
                instance.Credentials = new List <AccountCredential>();
            }
            if (instance.AccountLinks == null)
            {
                instance.AccountLinks = new List <GameAccountLink>();
            }
            while (limit < 0L || stream.get_Position() < limit)
            {
                int num = stream.ReadByte();
                if (num != -1)
                {
                    int num2 = num;
                    switch (num2)
                    {
                    case 21:
                        instance.Id = binaryReader.ReadUInt32();
                        continue;

                    case 22:
                    case 23:
IL_CB:
                        if (num2 == 34)
                        {
                            instance.Email.Add(ProtocolParser.ReadString(stream));
                            continue;
                        }
                        if (num2 == 40)
                        {
                            instance.Flags = ProtocolParser.ReadUInt64(stream);
                            continue;
                        }
                        if (num2 == 48)
                        {
                            instance.SecureRelease = ProtocolParser.ReadUInt64(stream);
                            continue;
                        }
                        if (num2 == 56)
                        {
                            instance.WhitelistStart = ProtocolParser.ReadUInt64(stream);
                            continue;
                        }
                        if (num2 == 64)
                        {
                            instance.WhitelistEnd = ProtocolParser.ReadUInt64(stream);
                            continue;
                        }
                        if (num2 != 82)
                        {
                            Key  key   = ProtocolParser.ReadKey((byte)num, stream);
                            uint field = key.Field;
                            switch (field)
                            {
                            case 20u:
                                if (key.WireType != Wire.LengthDelimited)
                                {
                                    continue;
                                }
                                instance.Licenses.Add(AccountLicense.DeserializeLengthDelimited(stream));
                                continue;

                            case 21u:
                                if (key.WireType != Wire.LengthDelimited)
                                {
                                    continue;
                                }
                                instance.Credentials.Add(AccountCredential.DeserializeLengthDelimited(stream));
                                continue;

                            case 22u:
                                if (key.WireType != Wire.LengthDelimited)
                                {
                                    continue;
                                }
                                instance.AccountLinks.Add(GameAccountLink.DeserializeLengthDelimited(stream));
                                continue;

                            case 23u:
                                if (key.WireType != Wire.LengthDelimited)
                                {
                                    continue;
                                }
                                instance.BattleTag = ProtocolParser.ReadString(stream);
                                continue;

                            case 24u:
                            case 28u:
                            case 29u:
IL_1E0:
                                if (field != 0u)
                                {
                                    ProtocolParser.SkipKey(stream, key);
                                    continue;
                                }
                                throw new ProtocolBufferException("Invalid field id: 0, something went wrong in the stream");

                            case 25u:
                                if (key.WireType != Wire.Fixed32)
                                {
                                    continue;
                                }
                                instance.DefaultCurrency = binaryReader.ReadUInt32();
                                continue;

                            case 26u:
                                if (key.WireType != Wire.Varint)
                                {
                                    continue;
                                }
                                instance.LegalRegion = ProtocolParser.ReadUInt32(stream);
                                continue;

                            case 27u:
                                if (key.WireType != Wire.Fixed32)
                                {
                                    continue;
                                }
                                instance.LegalLocale = binaryReader.ReadUInt32();
                                continue;

                            case 30u:
                                if (key.WireType != Wire.Varint)
                                {
                                    continue;
                                }
                                instance.CacheExpiration = ProtocolParser.ReadUInt64(stream);
                                continue;

                            case 31u:
                                if (key.WireType != Wire.LengthDelimited)
                                {
                                    continue;
                                }
                                if (instance.ParentalControlInfo == null)
                                {
                                    instance.ParentalControlInfo = ParentalControlInfo.DeserializeLengthDelimited(stream);
                                }
                                else
                                {
                                    ParentalControlInfo.DeserializeLengthDelimited(stream, instance.ParentalControlInfo);
                                }
                                continue;

                            case 32u:
                                if (key.WireType != Wire.LengthDelimited)
                                {
                                    continue;
                                }
                                instance.Country = ProtocolParser.ReadString(stream);
                                continue;

                            case 33u:
                                if (key.WireType != Wire.Varint)
                                {
                                    continue;
                                }
                                instance.PreferredRegion = ProtocolParser.ReadUInt32(stream);
                                continue;
                            }
                            goto IL_1E0;
                            continue;
                        }
                        instance.FullName = ProtocolParser.ReadString(stream);
                        continue;

                    case 24:
                        instance.Region = ProtocolParser.ReadUInt32(stream);
                        continue;
                    }
                    goto IL_CB;
                }
                if (limit >= 0L)
                {
                    throw new EndOfStreamException();
                }
                return(instance);
            }
            if (stream.get_Position() == limit)
            {
                return(instance);
            }
            throw new ProtocolBufferException("Read past max limit");
        }