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 uint GetSerializedSize()
        {
            uint num = 0u;

            if (this.HasAccountLevelInfo)
            {
                num += 1u;
                uint serializedSize = this.AccountLevelInfo.GetSerializedSize();
                num += serializedSize + ProtocolParser.SizeOfUInt32(serializedSize);
            }
            if (this.HasPrivacyInfo)
            {
                num += 1u;
                uint serializedSize2 = this.PrivacyInfo.GetSerializedSize();
                num += serializedSize2 + ProtocolParser.SizeOfUInt32(serializedSize2);
            }
            if (this.HasParentalControlInfo)
            {
                num += 1u;
                uint serializedSize3 = this.ParentalControlInfo.GetSerializedSize();
                num += serializedSize3 + ProtocolParser.SizeOfUInt32(serializedSize3);
            }
            if (this.GameLevelInfo.get_Count() > 0)
            {
                using (List <GameLevelInfo> .Enumerator enumerator = this.GameLevelInfo.GetEnumerator())
                {
                    while (enumerator.MoveNext())
                    {
                        GameLevelInfo current = enumerator.get_Current();
                        num += 1u;
                        uint serializedSize4 = current.GetSerializedSize();
                        num += serializedSize4 + ProtocolParser.SizeOfUInt32(serializedSize4);
                    }
                }
            }
            if (this.GameStatus.get_Count() > 0)
            {
                using (List <GameStatus> .Enumerator enumerator2 = this.GameStatus.GetEnumerator())
                {
                    while (enumerator2.MoveNext())
                    {
                        GameStatus current2 = enumerator2.get_Current();
                        num += 1u;
                        uint serializedSize5 = current2.GetSerializedSize();
                        num += serializedSize5 + ProtocolParser.SizeOfUInt32(serializedSize5);
                    }
                }
            }
            if (this.GameAccounts.get_Count() > 0)
            {
                using (List <GameAccountList> .Enumerator enumerator3 = this.GameAccounts.GetEnumerator())
                {
                    while (enumerator3.MoveNext())
                    {
                        GameAccountList current3 = enumerator3.get_Current();
                        num += 1u;
                        uint serializedSize6 = current3.GetSerializedSize();
                        num += serializedSize6 + ProtocolParser.SizeOfUInt32(serializedSize6);
                    }
                }
            }
            return(num);
        }