Esempio n. 1
0
        public uint GetSerializedSize()
        {
            uint num = 0u;

            if (this.HasIsStarterEdition)
            {
                num += 1u;
                num += 1u;
            }
            if (this.HasIsTrial)
            {
                num += 1u;
                num += 1u;
            }
            if (this.HasIsLifetime)
            {
                num += 1u;
                num += 1u;
            }
            if (this.HasIsRestricted)
            {
                num += 1u;
                num += 1u;
            }
            if (this.HasIsBeta)
            {
                num += 1u;
                num += 1u;
            }
            if (this.HasName)
            {
                num += 1u;
                uint byteCount = (uint)Encoding.get_UTF8().GetByteCount(this.Name);
                num += ProtocolParser.SizeOfUInt32(byteCount) + byteCount;
            }
            if (this.HasProgram)
            {
                num += 1u;
                num += 4u;
            }
            if (this.Licenses.get_Count() > 0)
            {
                using (List <AccountLicense> .Enumerator enumerator = this.Licenses.GetEnumerator())
                {
                    while (enumerator.MoveNext())
                    {
                        AccountLicense current = enumerator.get_Current();
                        num += 1u;
                        uint serializedSize = current.GetSerializedSize();
                        num += serializedSize + ProtocolParser.SizeOfUInt32(serializedSize);
                    }
                }
            }
            if (this.HasRealmPermissions)
            {
                num += 1u;
                num += ProtocolParser.SizeOfUInt32(this.RealmPermissions);
            }
            return(num);
        }
Esempio n. 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);
            }
        }
        public uint GetSerializedSize()
        {
            uint num = 0u;

            if (this.Licenses.get_Count() > 0)
            {
                using (List <AccountLicense> .Enumerator enumerator = this.Licenses.GetEnumerator())
                {
                    while (enumerator.MoveNext())
                    {
                        AccountLicense current = enumerator.get_Current();
                        num += 1u;
                        uint serializedSize = current.GetSerializedSize();
                        num += serializedSize + ProtocolParser.SizeOfUInt32(serializedSize);
                    }
                }
            }
            if (this.HasDefaultCurrency)
            {
                num += 1u;
                num += 4u;
            }
            if (this.HasCountry)
            {
                num += 1u;
                uint byteCount = (uint)Encoding.get_UTF8().GetByteCount(this.Country);
                num += ProtocolParser.SizeOfUInt32(byteCount) + byteCount;
            }
            if (this.HasPreferredRegion)
            {
                num += 1u;
                num += ProtocolParser.SizeOfUInt32(this.PreferredRegion);
            }
            return(num);
        }
        public override int GetHashCode()
        {
            int num = base.GetType().GetHashCode();

            using (List <AccountLicense> .Enumerator enumerator = this.Licenses.GetEnumerator())
            {
                while (enumerator.MoveNext())
                {
                    AccountLicense current = enumerator.get_Current();
                    num ^= current.GetHashCode();
                }
            }
            if (this.HasDefaultCurrency)
            {
                num ^= this.DefaultCurrency.GetHashCode();
            }
            if (this.HasCountry)
            {
                num ^= this.Country.GetHashCode();
            }
            if (this.HasPreferredRegion)
            {
                num ^= this.PreferredRegion.GetHashCode();
            }
            return(num);
        }
        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);
            }
        }
Esempio n. 6
0
        public static AccountLicense DeserializeLengthDelimited(Stream stream)
        {
            AccountLicense accountLicense = new AccountLicense();

            AccountLicense.DeserializeLengthDelimited(stream, accountLicense);
            return(accountLicense);
        }
Esempio n. 7
0
        public static AccountLicense DeserializeLengthDelimited(Stream stream, AccountLicense instance)
        {
            long num = (long)((ulong)ProtocolParser.ReadUInt32(stream));

            num += stream.Position;
            return(AccountLicense.Deserialize(stream, instance, num));
        }
Esempio n. 8
0
        public static void Serialize(Stream stream, GameLevelInfo instance)
        {
            BinaryWriter binaryWriter = new BinaryWriter(stream);

            if (instance.HasIsStarterEdition)
            {
                stream.WriteByte(24);
                ProtocolParser.WriteBool(stream, instance.IsStarterEdition);
            }
            if (instance.HasIsTrial)
            {
                stream.WriteByte(32);
                ProtocolParser.WriteBool(stream, instance.IsTrial);
            }
            if (instance.HasIsLifetime)
            {
                stream.WriteByte(40);
                ProtocolParser.WriteBool(stream, instance.IsLifetime);
            }
            if (instance.HasIsRestricted)
            {
                stream.WriteByte(48);
                ProtocolParser.WriteBool(stream, instance.IsRestricted);
            }
            if (instance.HasIsBeta)
            {
                stream.WriteByte(56);
                ProtocolParser.WriteBool(stream, instance.IsBeta);
            }
            if (instance.HasName)
            {
                stream.WriteByte(66);
                ProtocolParser.WriteBytes(stream, Encoding.get_UTF8().GetBytes(instance.Name));
            }
            if (instance.HasProgram)
            {
                stream.WriteByte(77);
                binaryWriter.Write(instance.Program);
            }
            if (instance.Licenses.get_Count() > 0)
            {
                using (List <AccountLicense> .Enumerator enumerator = instance.Licenses.GetEnumerator())
                {
                    while (enumerator.MoveNext())
                    {
                        AccountLicense current = enumerator.get_Current();
                        stream.WriteByte(82);
                        ProtocolParser.WriteUInt32(stream, current.GetSerializedSize());
                        AccountLicense.Serialize(stream, current);
                    }
                }
            }
            if (instance.HasRealmPermissions)
            {
                stream.WriteByte(88);
                ProtocolParser.WriteUInt32(stream, instance.RealmPermissions);
            }
        }
        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);
        }
Esempio n. 10
0
 public static void Serialize(Stream stream, AccountLicense instance)
 {
     stream.WriteByte(8);
     ProtocolParser.WriteUInt32(stream, instance.Id);
     if (instance.HasExpires)
     {
         stream.WriteByte(16);
         ProtocolParser.WriteUInt64(stream, instance.Expires);
     }
 }
Esempio n. 11
0
        public static void Serialize(Stream stream, GameLevelInfo instance)
        {
            BinaryWriter binaryWriter = new BinaryWriter(stream);

            if (instance.HasIsStarterEdition)
            {
                stream.WriteByte(24);
                ProtocolParser.WriteBool(stream, instance.IsStarterEdition);
            }
            if (instance.HasIsTrial)
            {
                stream.WriteByte(32);
                ProtocolParser.WriteBool(stream, instance.IsTrial);
            }
            if (instance.HasIsLifetime)
            {
                stream.WriteByte(40);
                ProtocolParser.WriteBool(stream, instance.IsLifetime);
            }
            if (instance.HasIsRestricted)
            {
                stream.WriteByte(48);
                ProtocolParser.WriteBool(stream, instance.IsRestricted);
            }
            if (instance.HasIsBeta)
            {
                stream.WriteByte(56);
                ProtocolParser.WriteBool(stream, instance.IsBeta);
            }
            if (instance.HasName)
            {
                stream.WriteByte(66);
                ProtocolParser.WriteBytes(stream, Encoding.UTF8.GetBytes(instance.Name));
            }
            if (instance.HasProgram)
            {
                stream.WriteByte(77);
                binaryWriter.Write(instance.Program);
            }
            if (instance.Licenses.Count > 0)
            {
                foreach (AccountLicense accountLicense in instance.Licenses)
                {
                    stream.WriteByte(82);
                    ProtocolParser.WriteUInt32(stream, accountLicense.GetSerializedSize());
                    AccountLicense.Serialize(stream, accountLicense);
                }
            }
            if (instance.HasRealmPermissions)
            {
                stream.WriteByte(88);
                ProtocolParser.WriteUInt32(stream, instance.RealmPermissions);
            }
        }
Esempio n. 12
0
        public override int GetHashCode()
        {
            int num = base.GetType().GetHashCode();

            num ^= this.GameAccount.GetHashCode();
            if (this.HasName)
            {
                num ^= this.Name.GetHashCode();
            }
            if (this.HasRealmPermissions)
            {
                num ^= this.RealmPermissions.GetHashCode();
            }
            num ^= this.Status.GetHashCode();
            if (this.HasFlags)
            {
                num ^= this.Flags.GetHashCode();
            }
            if (this.HasBillingFlags)
            {
                num ^= this.BillingFlags.GetHashCode();
            }
            num ^= this.CacheExpiration.GetHashCode();
            if (this.HasSubscriptionExpiration)
            {
                num ^= this.SubscriptionExpiration.GetHashCode();
            }
            if (this.HasUnitsRemaining)
            {
                num ^= this.UnitsRemaining.GetHashCode();
            }
            if (this.HasStatusExpiration)
            {
                num ^= this.StatusExpiration.GetHashCode();
            }
            if (this.HasBoxLevel)
            {
                num ^= this.BoxLevel.GetHashCode();
            }
            if (this.HasBoxLevelExpiration)
            {
                num ^= this.BoxLevelExpiration.GetHashCode();
            }
            using (List <AccountLicense> .Enumerator enumerator = this.Licenses.GetEnumerator())
            {
                while (enumerator.MoveNext())
                {
                    AccountLicense current = enumerator.get_Current();
                    num ^= current.GetHashCode();
                }
            }
            return(num);
        }
 public static void Serialize(Stream stream, GetLicensesResponse instance)
 {
     if (instance.Licenses.Count > 0)
     {
         foreach (AccountLicense accountLicense in instance.Licenses)
         {
             stream.WriteByte(10);
             ProtocolParser.WriteUInt32(stream, accountLicense.GetSerializedSize());
             AccountLicense.Serialize(stream, accountLicense);
         }
     }
 }
        public override int GetHashCode()
        {
            int num = base.GetType().GetHashCode();

            using (List <AccountLicense> .Enumerator enumerator = this.Licenses.GetEnumerator())
            {
                while (enumerator.MoveNext())
                {
                    AccountLicense current = enumerator.get_Current();
                    num ^= current.GetHashCode();
                }
            }
            return(num);
        }
 public static void Serialize(Stream stream, GetLicensesResponse instance)
 {
     if (instance.Licenses.get_Count() > 0)
     {
         using (List <AccountLicense> .Enumerator enumerator = instance.Licenses.GetEnumerator())
         {
             while (enumerator.MoveNext())
             {
                 AccountLicense current = enumerator.get_Current();
                 stream.WriteByte(10);
                 ProtocolParser.WriteUInt32(stream, current.GetSerializedSize());
                 AccountLicense.Serialize(stream, current);
             }
         }
     }
 }
Esempio n. 16
0
        public override int GetHashCode()
        {
            int num = base.GetType().GetHashCode();

            if (this.HasIsStarterEdition)
            {
                num ^= this.IsStarterEdition.GetHashCode();
            }
            if (this.HasIsTrial)
            {
                num ^= this.IsTrial.GetHashCode();
            }
            if (this.HasIsLifetime)
            {
                num ^= this.IsLifetime.GetHashCode();
            }
            if (this.HasIsRestricted)
            {
                num ^= this.IsRestricted.GetHashCode();
            }
            if (this.HasIsBeta)
            {
                num ^= this.IsBeta.GetHashCode();
            }
            if (this.HasName)
            {
                num ^= this.Name.GetHashCode();
            }
            if (this.HasProgram)
            {
                num ^= this.Program.GetHashCode();
            }
            using (List <AccountLicense> .Enumerator enumerator = this.Licenses.GetEnumerator())
            {
                while (enumerator.MoveNext())
                {
                    AccountLicense current = enumerator.get_Current();
                    num ^= current.GetHashCode();
                }
            }
            if (this.HasRealmPermissions)
            {
                num ^= this.RealmPermissions.GetHashCode();
            }
            return(num);
        }
Esempio n. 17
0
 public static AccountLicense Deserialize(Stream stream, AccountLicense instance, long limit)
 {
     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 != 8)
             {
                 if (num2 != 16)
                 {
                     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.Expires = ProtocolParser.ReadUInt64(stream);
                 }
             }
             else
             {
                 instance.Id = ProtocolParser.ReadUInt32(stream);
             }
         }
     }
     if (stream.get_Position() == limit)
     {
         return(instance);
     }
     throw new ProtocolBufferException("Read past max limit");
 }
Esempio n. 18
0
        public override bool Equals(object obj)
        {
            AccountLicense accountLicense = obj as AccountLicense;

            if (accountLicense == null)
            {
                return(false);
            }
            if (!this.Id.Equals(accountLicense.Id))
            {
                return(false);
            }
            if (this.HasExpires == accountLicense.HasExpires && (!this.HasExpires || this.Expires.Equals(accountLicense.Expires)))
            {
                return(true);
            }
            return(false);
        }
Esempio n. 19
0
 public static AccountLicense Deserialize(Stream stream, AccountLicense instance, long limit)
 {
     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 == 8)
             {
                 instance.Id = ProtocolParser.ReadUInt32(stream);
             }
             else if (num == 16)
             {
                 instance.Expires = ProtocolParser.ReadUInt64(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);
 }
Esempio n. 20
0
 public static GetLicensesResponse Deserialize(Stream stream, GetLicensesResponse instance, long limit)
 {
     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 == 10)
             {
                 instance.Licenses.Add(AccountLicense.DeserializeLengthDelimited(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);
 }
        public uint GetSerializedSize()
        {
            uint num = 0u;

            if (this.Licenses.get_Count() > 0)
            {
                using (List <AccountLicense> .Enumerator enumerator = this.Licenses.GetEnumerator())
                {
                    while (enumerator.MoveNext())
                    {
                        AccountLicense current = enumerator.get_Current();
                        num += 1u;
                        uint serializedSize = current.GetSerializedSize();
                        num += serializedSize + ProtocolParser.SizeOfUInt32(serializedSize);
                    }
                }
            }
            return(num);
        }
 public static GetLicensesResponse Deserialize(Stream stream, GetLicensesResponse instance, long limit)
 {
     if (instance.Licenses == null)
     {
         instance.Licenses = new List <AccountLicense>();
     }
     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)
             {
                 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.Licenses.Add(AccountLicense.DeserializeLengthDelimited(stream));
             }
         }
     }
     if (stream.get_Position() == limit)
     {
         return(instance);
     }
     throw new ProtocolBufferException("Read past max limit");
 }
 public void AddLicenses(AccountLicense val)
 {
     this._Licenses.Add(val);
 }
Esempio n. 24
0
 public void Deserialize(Stream stream)
 {
     AccountLicense.Deserialize(stream, this);
 }
Esempio n. 25
0
 public static AccountLicense Deserialize(Stream stream, AccountLicense instance)
 {
     return(AccountLicense.Deserialize(stream, instance, -1L));
 }
Esempio n. 26
0
        public override bool Equals(object obj)
        {
            AccountLicense accountLicense = obj as AccountLicense;

            return(accountLicense != null && this.Id.Equals(accountLicense.Id) && this.HasExpires == accountLicense.HasExpires && (!this.HasExpires || this.Expires.Equals(accountLicense.Expires)));
        }
Esempio n. 27
0
 public static void Serialize(Stream stream, GameAccountBlob instance)
 {
     if (instance.GameAccount == null)
     {
         throw new ArgumentNullException("GameAccount", "Required by proto specification.");
     }
     stream.WriteByte(10);
     ProtocolParser.WriteUInt32(stream, instance.GameAccount.GetSerializedSize());
     GameAccountHandle.Serialize(stream, instance.GameAccount);
     if (instance.HasName)
     {
         stream.WriteByte(18);
         ProtocolParser.WriteBytes(stream, Encoding.get_UTF8().GetBytes(instance.Name));
     }
     if (instance.HasRealmPermissions)
     {
         stream.WriteByte(24);
         ProtocolParser.WriteUInt32(stream, instance.RealmPermissions);
     }
     stream.WriteByte(32);
     ProtocolParser.WriteUInt32(stream, instance.Status);
     if (instance.HasFlags)
     {
         stream.WriteByte(40);
         ProtocolParser.WriteUInt64(stream, instance.Flags);
     }
     if (instance.HasBillingFlags)
     {
         stream.WriteByte(48);
         ProtocolParser.WriteUInt32(stream, instance.BillingFlags);
     }
     stream.WriteByte(56);
     ProtocolParser.WriteUInt64(stream, instance.CacheExpiration);
     if (instance.HasSubscriptionExpiration)
     {
         stream.WriteByte(80);
         ProtocolParser.WriteUInt64(stream, instance.SubscriptionExpiration);
     }
     if (instance.HasUnitsRemaining)
     {
         stream.WriteByte(88);
         ProtocolParser.WriteUInt32(stream, instance.UnitsRemaining);
     }
     if (instance.HasStatusExpiration)
     {
         stream.WriteByte(96);
         ProtocolParser.WriteUInt64(stream, instance.StatusExpiration);
     }
     if (instance.HasBoxLevel)
     {
         stream.WriteByte(104);
         ProtocolParser.WriteUInt32(stream, instance.BoxLevel);
     }
     if (instance.HasBoxLevelExpiration)
     {
         stream.WriteByte(112);
         ProtocolParser.WriteUInt64(stream, instance.BoxLevelExpiration);
     }
     if (instance.Licenses.get_Count() > 0)
     {
         using (List <AccountLicense> .Enumerator enumerator = instance.Licenses.GetEnumerator())
         {
             while (enumerator.MoveNext())
             {
                 AccountLicense current = enumerator.get_Current();
                 stream.WriteByte(162);
                 stream.WriteByte(1);
                 ProtocolParser.WriteUInt32(stream, current.GetSerializedSize());
                 AccountLicense.Serialize(stream, current);
             }
         }
     }
 }
Esempio n. 28
0
 public static void Serialize(Stream stream, GameAccountBlob instance)
 {
     if (instance.GameAccount == null)
     {
         throw new ArgumentNullException("GameAccount", "Required by proto specification.");
     }
     stream.WriteByte(10);
     ProtocolParser.WriteUInt32(stream, instance.GameAccount.GetSerializedSize());
     GameAccountHandle.Serialize(stream, instance.GameAccount);
     if (instance.HasName)
     {
         stream.WriteByte(18);
         ProtocolParser.WriteBytes(stream, Encoding.UTF8.GetBytes(instance.Name));
     }
     if (instance.HasRealmPermissions)
     {
         stream.WriteByte(24);
         ProtocolParser.WriteUInt32(stream, instance.RealmPermissions);
     }
     stream.WriteByte(32);
     ProtocolParser.WriteUInt32(stream, instance.Status);
     if (instance.HasFlags)
     {
         stream.WriteByte(40);
         ProtocolParser.WriteUInt64(stream, instance.Flags);
     }
     if (instance.HasBillingFlags)
     {
         stream.WriteByte(48);
         ProtocolParser.WriteUInt32(stream, instance.BillingFlags);
     }
     stream.WriteByte(56);
     ProtocolParser.WriteUInt64(stream, instance.CacheExpiration);
     if (instance.HasSubscriptionExpiration)
     {
         stream.WriteByte(80);
         ProtocolParser.WriteUInt64(stream, instance.SubscriptionExpiration);
     }
     if (instance.HasUnitsRemaining)
     {
         stream.WriteByte(88);
         ProtocolParser.WriteUInt32(stream, instance.UnitsRemaining);
     }
     if (instance.HasStatusExpiration)
     {
         stream.WriteByte(96);
         ProtocolParser.WriteUInt64(stream, instance.StatusExpiration);
     }
     if (instance.HasBoxLevel)
     {
         stream.WriteByte(104);
         ProtocolParser.WriteUInt32(stream, instance.BoxLevel);
     }
     if (instance.HasBoxLevelExpiration)
     {
         stream.WriteByte(112);
         ProtocolParser.WriteUInt64(stream, instance.BoxLevelExpiration);
     }
     if (instance.Licenses.Count > 0)
     {
         foreach (AccountLicense accountLicense in instance.Licenses)
         {
             stream.WriteByte(162);
             stream.WriteByte(1);
             ProtocolParser.WriteUInt32(stream, accountLicense.GetSerializedSize());
             AccountLicense.Serialize(stream, accountLicense);
         }
     }
 }
Esempio n. 29
0
 public static GameAccountBlob Deserialize(Stream stream, GameAccountBlob instance, long limit)
 {
     instance.Name             = string.Empty;
     instance.RealmPermissions = 0u;
     instance.Flags            = 0UL;
     instance.BillingFlags     = 0u;
     if (instance.Licenses == null)
     {
         instance.Licenses = new List <AccountLicense>();
     }
     while (limit < 0L || stream.Position < limit)
     {
         int num = stream.ReadByte();
         if (num == -1)
         {
             if (limit >= 0L)
             {
                 throw new EndOfStreamException();
             }
             return(instance);
         }
         else if (num != 10)
         {
             if (num != 18)
             {
                 if (num != 24)
                 {
                     if (num != 32)
                     {
                         if (num != 40)
                         {
                             if (num != 48)
                             {
                                 if (num != 56)
                                 {
                                     if (num != 80)
                                     {
                                         if (num != 88)
                                         {
                                             if (num != 96)
                                             {
                                                 if (num != 104)
                                                 {
                                                     if (num != 112)
                                                     {
                                                         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");
                                                         }
                                                         if (field != 20u)
                                                         {
                                                             ProtocolParser.SkipKey(stream, key);
                                                         }
                                                         else if (key.WireType == Wire.LengthDelimited)
                                                         {
                                                             instance.Licenses.Add(AccountLicense.DeserializeLengthDelimited(stream));
                                                         }
                                                     }
                                                     else
                                                     {
                                                         instance.BoxLevelExpiration = ProtocolParser.ReadUInt64(stream);
                                                     }
                                                 }
                                                 else
                                                 {
                                                     instance.BoxLevel = ProtocolParser.ReadUInt32(stream);
                                                 }
                                             }
                                             else
                                             {
                                                 instance.StatusExpiration = ProtocolParser.ReadUInt64(stream);
                                             }
                                         }
                                         else
                                         {
                                             instance.UnitsRemaining = ProtocolParser.ReadUInt32(stream);
                                         }
                                     }
                                     else
                                     {
                                         instance.SubscriptionExpiration = ProtocolParser.ReadUInt64(stream);
                                     }
                                 }
                                 else
                                 {
                                     instance.CacheExpiration = ProtocolParser.ReadUInt64(stream);
                                 }
                             }
                             else
                             {
                                 instance.BillingFlags = ProtocolParser.ReadUInt32(stream);
                             }
                         }
                         else
                         {
                             instance.Flags = ProtocolParser.ReadUInt64(stream);
                         }
                     }
                     else
                     {
                         instance.Status = ProtocolParser.ReadUInt32(stream);
                     }
                 }
                 else
                 {
                     instance.RealmPermissions = ProtocolParser.ReadUInt32(stream);
                 }
             }
             else
             {
                 instance.Name = ProtocolParser.ReadString(stream);
             }
         }
         else if (instance.GameAccount == null)
         {
             instance.GameAccount = GameAccountHandle.DeserializeLengthDelimited(stream);
         }
         else
         {
             GameAccountHandle.DeserializeLengthDelimited(stream, instance.GameAccount);
         }
     }
     if (stream.Position == limit)
     {
         return(instance);
     }
     throw new ProtocolBufferException("Read past max limit");
 }
Esempio n. 30
0
        public uint GetSerializedSize()
        {
            uint num            = 0u;
            uint serializedSize = this.GameAccount.GetSerializedSize();

            num += serializedSize + ProtocolParser.SizeOfUInt32(serializedSize);
            if (this.HasName)
            {
                num += 1u;
                uint byteCount = (uint)Encoding.get_UTF8().GetByteCount(this.Name);
                num += ProtocolParser.SizeOfUInt32(byteCount) + byteCount;
            }
            if (this.HasRealmPermissions)
            {
                num += 1u;
                num += ProtocolParser.SizeOfUInt32(this.RealmPermissions);
            }
            num += ProtocolParser.SizeOfUInt32(this.Status);
            if (this.HasFlags)
            {
                num += 1u;
                num += ProtocolParser.SizeOfUInt64(this.Flags);
            }
            if (this.HasBillingFlags)
            {
                num += 1u;
                num += ProtocolParser.SizeOfUInt32(this.BillingFlags);
            }
            num += ProtocolParser.SizeOfUInt64(this.CacheExpiration);
            if (this.HasSubscriptionExpiration)
            {
                num += 1u;
                num += ProtocolParser.SizeOfUInt64(this.SubscriptionExpiration);
            }
            if (this.HasUnitsRemaining)
            {
                num += 1u;
                num += ProtocolParser.SizeOfUInt32(this.UnitsRemaining);
            }
            if (this.HasStatusExpiration)
            {
                num += 1u;
                num += ProtocolParser.SizeOfUInt64(this.StatusExpiration);
            }
            if (this.HasBoxLevel)
            {
                num += 1u;
                num += ProtocolParser.SizeOfUInt32(this.BoxLevel);
            }
            if (this.HasBoxLevelExpiration)
            {
                num += 1u;
                num += ProtocolParser.SizeOfUInt64(this.BoxLevelExpiration);
            }
            if (this.Licenses.get_Count() > 0)
            {
                using (List <AccountLicense> .Enumerator enumerator = this.Licenses.GetEnumerator())
                {
                    while (enumerator.MoveNext())
                    {
                        AccountLicense current = enumerator.get_Current();
                        num += 2u;
                        uint serializedSize2 = current.GetSerializedSize();
                        num += serializedSize2 + ProtocolParser.SizeOfUInt32(serializedSize2);
                    }
                }
            }
            num += 3u;
            return(num);
        }