Пример #1
0
        public static AccountLevelInfo DeserializeLengthDelimited(Stream stream)
        {
            AccountLevelInfo accountLevelInfo = new AccountLevelInfo();

            AccountLevelInfo.DeserializeLengthDelimited(stream, accountLevelInfo);
            return(accountLevelInfo);
        }
Пример #2
0
        public static void Serialize(Stream stream, AccountLevelInfo instance)
        {
            BinaryWriter binaryWriter = new BinaryWriter(stream);

            if (instance.Licenses.Count > 0)
            {
                foreach (AccountLicense accountLicense in instance.Licenses)
                {
                    stream.WriteByte(26);
                    ProtocolParser.WriteUInt32(stream, accountLicense.GetSerializedSize());
                    AccountLicense.Serialize(stream, accountLicense);
                }
            }
            if (instance.HasDefaultCurrency)
            {
                stream.WriteByte(37);
                binaryWriter.Write(instance.DefaultCurrency);
            }
            if (instance.HasCountry)
            {
                stream.WriteByte(42);
                ProtocolParser.WriteBytes(stream, Encoding.UTF8.GetBytes(instance.Country));
            }
            if (instance.HasPreferredRegion)
            {
                stream.WriteByte(48);
                ProtocolParser.WriteUInt32(stream, instance.PreferredRegion);
            }
        }
Пример #3
0
        public static AccountLevelInfo DeserializeLengthDelimited(Stream stream, AccountLevelInfo instance)
        {
            long num = (long)((ulong)ProtocolParser.ReadUInt32(stream));

            num += stream.Position;
            return(AccountLevelInfo.Deserialize(stream, instance, num));
        }
        public override bool Equals(object obj)
        {
            AccountLevelInfo accountLevelInfo = obj as AccountLevelInfo;

            if (accountLevelInfo == null)
            {
                return(false);
            }
            if (this.Licenses.Count != accountLevelInfo.Licenses.Count)
            {
                return(false);
            }
            for (int i = 0; i < this.Licenses.Count; i++)
            {
                if (!this.Licenses[i].Equals(accountLevelInfo.Licenses[i]))
                {
                    return(false);
                }
            }
            if (this.HasDefaultCurrency != accountLevelInfo.HasDefaultCurrency || this.HasDefaultCurrency && !this.DefaultCurrency.Equals(accountLevelInfo.DefaultCurrency))
            {
                return(false);
            }
            if (this.HasCountry != accountLevelInfo.HasCountry || this.HasCountry && !this.Country.Equals(accountLevelInfo.Country))
            {
                return(false);
            }
            if (this.HasPreferredRegion == accountLevelInfo.HasPreferredRegion && (!this.HasPreferredRegion || this.PreferredRegion.Equals(accountLevelInfo.PreferredRegion)))
            {
                return(true);
            }
            return(false);
        }
        public static void Serialize(Stream stream, AccountLevelInfo instance)
        {
            BinaryWriter binaryWriter = new BinaryWriter(stream);

            if (instance.Licenses.get_Count() > 0)
            {
                using (List <AccountLicense> .Enumerator enumerator = instance.Licenses.GetEnumerator())
                {
                    while (enumerator.MoveNext())
                    {
                        AccountLicense current = enumerator.get_Current();
                        stream.WriteByte(26);
                        ProtocolParser.WriteUInt32(stream, current.GetSerializedSize());
                        AccountLicense.Serialize(stream, current);
                    }
                }
            }
            if (instance.HasDefaultCurrency)
            {
                stream.WriteByte(37);
                binaryWriter.Write(instance.DefaultCurrency);
            }
            if (instance.HasCountry)
            {
                stream.WriteByte(42);
                ProtocolParser.WriteBytes(stream, Encoding.get_UTF8().GetBytes(instance.Country));
            }
            if (instance.HasPreferredRegion)
            {
                stream.WriteByte(48);
                ProtocolParser.WriteUInt32(stream, instance.PreferredRegion);
            }
        }
 public static void Serialize(Stream stream, AccountState instance)
 {
     if (instance.HasAccountLevelInfo)
     {
         stream.WriteByte(10);
         ProtocolParser.WriteUInt32(stream, instance.AccountLevelInfo.GetSerializedSize());
         AccountLevelInfo.Serialize(stream, instance.AccountLevelInfo);
     }
     if (instance.HasPrivacyInfo)
     {
         stream.WriteByte(18);
         ProtocolParser.WriteUInt32(stream, instance.PrivacyInfo.GetSerializedSize());
         PrivacyInfo.Serialize(stream, instance.PrivacyInfo);
     }
     if (instance.HasParentalControlInfo)
     {
         stream.WriteByte(26);
         ProtocolParser.WriteUInt32(stream, instance.ParentalControlInfo.GetSerializedSize());
         ParentalControlInfo.Serialize(stream, instance.ParentalControlInfo);
     }
     if (instance.GameLevelInfo.get_Count() > 0)
     {
         using (List <GameLevelInfo> .Enumerator enumerator = instance.GameLevelInfo.GetEnumerator())
         {
             while (enumerator.MoveNext())
             {
                 GameLevelInfo current = enumerator.get_Current();
                 stream.WriteByte(42);
                 ProtocolParser.WriteUInt32(stream, current.GetSerializedSize());
                 bnet.protocol.account.GameLevelInfo.Serialize(stream, current);
             }
         }
     }
     if (instance.GameStatus.get_Count() > 0)
     {
         using (List <GameStatus> .Enumerator enumerator2 = instance.GameStatus.GetEnumerator())
         {
             while (enumerator2.MoveNext())
             {
                 GameStatus current2 = enumerator2.get_Current();
                 stream.WriteByte(50);
                 ProtocolParser.WriteUInt32(stream, current2.GetSerializedSize());
                 bnet.protocol.account.GameStatus.Serialize(stream, current2);
             }
         }
     }
     if (instance.GameAccounts.get_Count() > 0)
     {
         using (List <GameAccountList> .Enumerator enumerator3 = instance.GameAccounts.GetEnumerator())
         {
             while (enumerator3.MoveNext())
             {
                 GameAccountList current3 = enumerator3.get_Current();
                 stream.WriteByte(58);
                 ProtocolParser.WriteUInt32(stream, current3.GetSerializedSize());
                 GameAccountList.Serialize(stream, current3);
             }
         }
     }
 }
        public static AccountLevelInfo Deserialize(Stream stream, AccountLevelInfo instance, long limit)
        {
            BinaryReader binaryReader = new BinaryReader(stream);

            if (instance.Licenses == null)
            {
                instance.Licenses = new List <AccountLicense>();
            }
            while (true)
            {
                if (limit < (long)0 || stream.Position < limit)
                {
                    int num = stream.ReadByte();
                    if (num == -1)
                    {
                        if (limit >= (long)0)
                        {
                            throw new EndOfStreamException();
                        }
                        break;
                    }
                    else if (num == 26)
                    {
                        instance.Licenses.Add(AccountLicense.DeserializeLengthDelimited(stream));
                    }
                    else if (num == 37)
                    {
                        instance.DefaultCurrency = binaryReader.ReadUInt32();
                    }
                    else if (num == 42)
                    {
                        instance.Country = ProtocolParser.ReadString(stream);
                    }
                    else if (num == 48)
                    {
                        instance.PreferredRegion = ProtocolParser.ReadUInt32(stream);
                    }
                    else
                    {
                        Key key = ProtocolParser.ReadKey((byte)num, stream);
                        if (key.Field == 0)
                        {
                            throw new ProtocolBufferException("Invalid field id: 0, something went wrong in the stream");
                        }
                        ProtocolParser.SkipKey(stream, key);
                    }
                }
                else
                {
                    if (stream.Position != limit)
                    {
                        throw new ProtocolBufferException("Read past max limit");
                    }
                    break;
                }
            }
            return(instance);
        }
Пример #8
0
 public static void Serialize(Stream stream, AccountState instance)
 {
     if (instance.HasAccountLevelInfo)
     {
         stream.WriteByte(10);
         ProtocolParser.WriteUInt32(stream, instance.AccountLevelInfo.GetSerializedSize());
         AccountLevelInfo.Serialize(stream, instance.AccountLevelInfo);
     }
     if (instance.HasPrivacyInfo)
     {
         stream.WriteByte(18);
         ProtocolParser.WriteUInt32(stream, instance.PrivacyInfo.GetSerializedSize());
         PrivacyInfo.Serialize(stream, instance.PrivacyInfo);
     }
     if (instance.HasParentalControlInfo)
     {
         stream.WriteByte(26);
         ProtocolParser.WriteUInt32(stream, instance.ParentalControlInfo.GetSerializedSize());
         ParentalControlInfo.Serialize(stream, instance.ParentalControlInfo);
     }
     if (instance.GameLevelInfo.Count > 0)
     {
         foreach (GameLevelInfo gameLevelInfo in instance.GameLevelInfo)
         {
             stream.WriteByte(42);
             ProtocolParser.WriteUInt32(stream, gameLevelInfo.GetSerializedSize());
             bnet.protocol.account.GameLevelInfo.Serialize(stream, gameLevelInfo);
         }
     }
     if (instance.GameStatus.Count > 0)
     {
         foreach (GameStatus gameStatus in instance.GameStatus)
         {
             stream.WriteByte(50);
             ProtocolParser.WriteUInt32(stream, gameStatus.GetSerializedSize());
             bnet.protocol.account.GameStatus.Serialize(stream, gameStatus);
         }
     }
     if (instance.GameAccounts.Count > 0)
     {
         foreach (GameAccountList gameAccountList in instance.GameAccounts)
         {
             stream.WriteByte(58);
             ProtocolParser.WriteUInt32(stream, gameAccountList.GetSerializedSize());
             GameAccountList.Serialize(stream, gameAccountList);
         }
     }
 }
        public override bool Equals(object obj)
        {
            AccountLevelInfo accountLevelInfo = obj as AccountLevelInfo;

            if (accountLevelInfo == null)
            {
                return(false);
            }
            if (this.Licenses.get_Count() != accountLevelInfo.Licenses.get_Count())
            {
                return(false);
            }
            for (int i = 0; i < this.Licenses.get_Count(); i++)
            {
                if (!this.Licenses.get_Item(i).Equals(accountLevelInfo.Licenses.get_Item(i)))
                {
                    return(false);
                }
            }
            return(this.HasDefaultCurrency == accountLevelInfo.HasDefaultCurrency && (!this.HasDefaultCurrency || this.DefaultCurrency.Equals(accountLevelInfo.DefaultCurrency)) && this.HasCountry == accountLevelInfo.HasCountry && (!this.HasCountry || this.Country.Equals(accountLevelInfo.Country)) && this.HasPreferredRegion == accountLevelInfo.HasPreferredRegion && (!this.HasPreferredRegion || this.PreferredRegion.Equals(accountLevelInfo.PreferredRegion)));
        }
Пример #10
0
 public void Serialize(Stream stream)
 {
     AccountLevelInfo.Serialize(stream, this);
 }
Пример #11
0
 public static AccountLevelInfo Deserialize(Stream stream, AccountLevelInfo instance)
 {
     return(AccountLevelInfo.Deserialize(stream, instance, -1L));
 }
 public void SetAccountLevelInfo(AccountLevelInfo val)
 {
     this.AccountLevelInfo = val;
 }
 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");
 }