Beispiel #1
0
        public static ParentalControlInfo DeserializeLengthDelimited(Stream stream)
        {
            ParentalControlInfo parentalControlInfo = new ParentalControlInfo();

            ParentalControlInfo.DeserializeLengthDelimited(stream, parentalControlInfo);
            return(parentalControlInfo);
        }
Beispiel #2
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");
        }
Beispiel #3
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");
 }
 public static AccountState Deserialize(Stream stream, AccountState instance, long limit)
 {
     if (instance.GameLevelInfo == null)
     {
         instance.GameLevelInfo = new List <GameLevelInfo>();
     }
     if (instance.GameStatus == null)
     {
         instance.GameStatus = new List <GameStatus>();
     }
     if (instance.GameAccounts == null)
     {
         instance.GameAccounts = new List <GameAccountList>();
     }
     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 != 10)
             {
                 if (num2 != 18)
                 {
                     if (num2 != 26)
                     {
                         if (num2 != 42)
                         {
                             if (num2 != 50)
                             {
                                 if (num2 != 58)
                                 {
                                     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.GameAccounts.Add(GameAccountList.DeserializeLengthDelimited(stream));
                                 }
                             }
                             else
                             {
                                 instance.GameStatus.Add(bnet.protocol.account.GameStatus.DeserializeLengthDelimited(stream));
                             }
                         }
                         else
                         {
                             instance.GameLevelInfo.Add(bnet.protocol.account.GameLevelInfo.DeserializeLengthDelimited(stream));
                         }
                     }
                     else if (instance.ParentalControlInfo == null)
                     {
                         instance.ParentalControlInfo = ParentalControlInfo.DeserializeLengthDelimited(stream);
                     }
                     else
                     {
                         ParentalControlInfo.DeserializeLengthDelimited(stream, instance.ParentalControlInfo);
                     }
                 }
                 else if (instance.PrivacyInfo == null)
                 {
                     instance.PrivacyInfo = PrivacyInfo.DeserializeLengthDelimited(stream);
                 }
                 else
                 {
                     PrivacyInfo.DeserializeLengthDelimited(stream, instance.PrivacyInfo);
                 }
             }
             else if (instance.AccountLevelInfo == null)
             {
                 instance.AccountLevelInfo = AccountLevelInfo.DeserializeLengthDelimited(stream);
             }
             else
             {
                 AccountLevelInfo.DeserializeLengthDelimited(stream, instance.AccountLevelInfo);
             }
         }
     }
     if (stream.get_Position() == limit)
     {
         return(instance);
     }
     throw new ProtocolBufferException("Read past max limit");
 }