public static void Serialize(Stream stream, CredentialUpdateRequest instance)
 {
     if (instance.Account == null)
     {
         throw new ArgumentNullException("Account", "Required by proto specification.");
     }
     stream.WriteByte(10);
     ProtocolParser.WriteUInt32(stream, instance.Account.GetSerializedSize());
     AccountId.Serialize(stream, instance.Account);
     if (instance.OldCredentials.Count > 0)
     {
         foreach (AccountCredential accountCredential in instance.OldCredentials)
         {
             stream.WriteByte(18);
             ProtocolParser.WriteUInt32(stream, accountCredential.GetSerializedSize());
             AccountCredential.Serialize(stream, accountCredential);
         }
     }
     if (instance.NewCredentials.Count > 0)
     {
         foreach (AccountCredential accountCredential2 in instance.NewCredentials)
         {
             stream.WriteByte(26);
             ProtocolParser.WriteUInt32(stream, accountCredential2.GetSerializedSize());
             AccountCredential.Serialize(stream, accountCredential2);
         }
     }
     if (instance.HasRegion)
     {
         stream.WriteByte(32);
         ProtocolParser.WriteUInt32(stream, instance.Region);
     }
 }
 public static void Serialize(Stream stream, CredentialUpdateRequest instance)
 {
     if (instance.Account == null)
     {
         throw new ArgumentNullException("Account", "Required by proto specification.");
     }
     stream.WriteByte(10);
     ProtocolParser.WriteUInt32(stream, instance.Account.GetSerializedSize());
     AccountId.Serialize(stream, instance.Account);
     if (instance.OldCredentials.get_Count() > 0)
     {
         using (List <AccountCredential> .Enumerator enumerator = instance.OldCredentials.GetEnumerator())
         {
             while (enumerator.MoveNext())
             {
                 AccountCredential current = enumerator.get_Current();
                 stream.WriteByte(18);
                 ProtocolParser.WriteUInt32(stream, current.GetSerializedSize());
                 AccountCredential.Serialize(stream, current);
             }
         }
     }
     if (instance.NewCredentials.get_Count() > 0)
     {
         using (List <AccountCredential> .Enumerator enumerator2 = instance.NewCredentials.GetEnumerator())
         {
             while (enumerator2.MoveNext())
             {
                 AccountCredential current2 = enumerator2.get_Current();
                 stream.WriteByte(26);
                 ProtocolParser.WriteUInt32(stream, current2.GetSerializedSize());
                 AccountCredential.Serialize(stream, current2);
             }
         }
     }
     if (instance.HasRegion)
     {
         stream.WriteByte(32);
         ProtocolParser.WriteUInt32(stream, instance.Region);
     }
 }
Beispiel #3
0
        public static void Serialize(Stream stream, AccountBlob instance)
        {
            BinaryWriter binaryWriter = new BinaryWriter(stream);

            stream.WriteByte(21);
            binaryWriter.Write(instance.Id);
            stream.WriteByte(24);
            ProtocolParser.WriteUInt32(stream, instance.Region);
            if (instance.Email.Count > 0)
            {
                foreach (string email in instance.Email)
                {
                    stream.WriteByte(34);
                    ProtocolParser.WriteBytes(stream, Encoding.UTF8.GetBytes(email));
                }
            }
            stream.WriteByte(40);
            ProtocolParser.WriteUInt64(stream, instance.Flags);
            if (instance.HasSecureRelease)
            {
                stream.WriteByte(48);
                ProtocolParser.WriteUInt64(stream, instance.SecureRelease);
            }
            if (instance.HasWhitelistStart)
            {
                stream.WriteByte(56);
                ProtocolParser.WriteUInt64(stream, instance.WhitelistStart);
            }
            if (instance.HasWhitelistEnd)
            {
                stream.WriteByte(64);
                ProtocolParser.WriteUInt64(stream, instance.WhitelistEnd);
            }
            if (instance.FullName == null)
            {
                throw new ArgumentNullException("FullName", "Required by proto specification.");
            }
            stream.WriteByte(82);
            ProtocolParser.WriteBytes(stream, Encoding.UTF8.GetBytes(instance.FullName));
            if (instance.Licenses.Count > 0)
            {
                foreach (AccountLicense license in instance.Licenses)
                {
                    stream.WriteByte(162);
                    stream.WriteByte(1);
                    ProtocolParser.WriteUInt32(stream, license.GetSerializedSize());
                    AccountLicense.Serialize(stream, license);
                }
            }
            if (instance.Credentials.Count > 0)
            {
                foreach (AccountCredential credential in instance.Credentials)
                {
                    stream.WriteByte(170);
                    stream.WriteByte(1);
                    ProtocolParser.WriteUInt32(stream, credential.GetSerializedSize());
                    AccountCredential.Serialize(stream, credential);
                }
            }
            if (instance.AccountLinks.Count > 0)
            {
                foreach (GameAccountLink accountLink in instance.AccountLinks)
                {
                    stream.WriteByte(178);
                    stream.WriteByte(1);
                    ProtocolParser.WriteUInt32(stream, accountLink.GetSerializedSize());
                    GameAccountLink.Serialize(stream, accountLink);
                }
            }
            if (instance.HasBattleTag)
            {
                stream.WriteByte(186);
                stream.WriteByte(1);
                ProtocolParser.WriteBytes(stream, Encoding.UTF8.GetBytes(instance.BattleTag));
            }
            if (instance.HasDefaultCurrency)
            {
                stream.WriteByte(205);
                stream.WriteByte(1);
                binaryWriter.Write(instance.DefaultCurrency);
            }
            if (instance.HasLegalRegion)
            {
                stream.WriteByte(208);
                stream.WriteByte(1);
                ProtocolParser.WriteUInt32(stream, instance.LegalRegion);
            }
            if (instance.HasLegalLocale)
            {
                stream.WriteByte(221);
                stream.WriteByte(1);
                binaryWriter.Write(instance.LegalLocale);
            }
            stream.WriteByte(240);
            stream.WriteByte(1);
            ProtocolParser.WriteUInt64(stream, instance.CacheExpiration);
            if (instance.HasParentalControlInfo)
            {
                stream.WriteByte(250);
                stream.WriteByte(1);
                ProtocolParser.WriteUInt32(stream, instance.ParentalControlInfo.GetSerializedSize());
                bnet.protocol.account.ParentalControlInfo.Serialize(stream, instance.ParentalControlInfo);
            }
            if (instance.HasCountry)
            {
                stream.WriteByte(130);
                stream.WriteByte(2);
                ProtocolParser.WriteBytes(stream, Encoding.UTF8.GetBytes(instance.Country));
            }
            if (instance.HasPreferredRegion)
            {
                stream.WriteByte(136);
                stream.WriteByte(2);
                ProtocolParser.WriteUInt32(stream, instance.PreferredRegion);
            }
        }
Beispiel #4
0
 public void Serialize(Stream stream)
 {
     AccountCredential.Serialize(stream, this);
 }
Beispiel #5
0
        public static void Serialize(Stream stream, AccountBlob instance)
        {
            BinaryWriter binaryWriter = new BinaryWriter(stream);

            stream.WriteByte(21);
            binaryWriter.Write(instance.Id);
            stream.WriteByte(24);
            ProtocolParser.WriteUInt32(stream, instance.Region);
            if (instance.Email.get_Count() > 0)
            {
                using (List <string> .Enumerator enumerator = instance.Email.GetEnumerator())
                {
                    while (enumerator.MoveNext())
                    {
                        string current = enumerator.get_Current();
                        stream.WriteByte(34);
                        ProtocolParser.WriteBytes(stream, Encoding.get_UTF8().GetBytes(current));
                    }
                }
            }
            stream.WriteByte(40);
            ProtocolParser.WriteUInt64(stream, instance.Flags);
            if (instance.HasSecureRelease)
            {
                stream.WriteByte(48);
                ProtocolParser.WriteUInt64(stream, instance.SecureRelease);
            }
            if (instance.HasWhitelistStart)
            {
                stream.WriteByte(56);
                ProtocolParser.WriteUInt64(stream, instance.WhitelistStart);
            }
            if (instance.HasWhitelistEnd)
            {
                stream.WriteByte(64);
                ProtocolParser.WriteUInt64(stream, instance.WhitelistEnd);
            }
            if (instance.FullName == null)
            {
                throw new ArgumentNullException("FullName", "Required by proto specification.");
            }
            stream.WriteByte(82);
            ProtocolParser.WriteBytes(stream, Encoding.get_UTF8().GetBytes(instance.FullName));
            if (instance.Licenses.get_Count() > 0)
            {
                using (List <AccountLicense> .Enumerator enumerator2 = instance.Licenses.GetEnumerator())
                {
                    while (enumerator2.MoveNext())
                    {
                        AccountLicense current2 = enumerator2.get_Current();
                        stream.WriteByte(162);
                        stream.WriteByte(1);
                        ProtocolParser.WriteUInt32(stream, current2.GetSerializedSize());
                        AccountLicense.Serialize(stream, current2);
                    }
                }
            }
            if (instance.Credentials.get_Count() > 0)
            {
                using (List <AccountCredential> .Enumerator enumerator3 = instance.Credentials.GetEnumerator())
                {
                    while (enumerator3.MoveNext())
                    {
                        AccountCredential current3 = enumerator3.get_Current();
                        stream.WriteByte(170);
                        stream.WriteByte(1);
                        ProtocolParser.WriteUInt32(stream, current3.GetSerializedSize());
                        AccountCredential.Serialize(stream, current3);
                    }
                }
            }
            if (instance.AccountLinks.get_Count() > 0)
            {
                using (List <GameAccountLink> .Enumerator enumerator4 = instance.AccountLinks.GetEnumerator())
                {
                    while (enumerator4.MoveNext())
                    {
                        GameAccountLink current4 = enumerator4.get_Current();
                        stream.WriteByte(178);
                        stream.WriteByte(1);
                        ProtocolParser.WriteUInt32(stream, current4.GetSerializedSize());
                        GameAccountLink.Serialize(stream, current4);
                    }
                }
            }
            if (instance.HasBattleTag)
            {
                stream.WriteByte(186);
                stream.WriteByte(1);
                ProtocolParser.WriteBytes(stream, Encoding.get_UTF8().GetBytes(instance.BattleTag));
            }
            if (instance.HasDefaultCurrency)
            {
                stream.WriteByte(205);
                stream.WriteByte(1);
                binaryWriter.Write(instance.DefaultCurrency);
            }
            if (instance.HasLegalRegion)
            {
                stream.WriteByte(208);
                stream.WriteByte(1);
                ProtocolParser.WriteUInt32(stream, instance.LegalRegion);
            }
            if (instance.HasLegalLocale)
            {
                stream.WriteByte(221);
                stream.WriteByte(1);
                binaryWriter.Write(instance.LegalLocale);
            }
            stream.WriteByte(240);
            stream.WriteByte(1);
            ProtocolParser.WriteUInt64(stream, instance.CacheExpiration);
            if (instance.HasParentalControlInfo)
            {
                stream.WriteByte(250);
                stream.WriteByte(1);
                ProtocolParser.WriteUInt32(stream, instance.ParentalControlInfo.GetSerializedSize());
                ParentalControlInfo.Serialize(stream, instance.ParentalControlInfo);
            }
            if (instance.HasCountry)
            {
                stream.WriteByte(130);
                stream.WriteByte(2);
                ProtocolParser.WriteBytes(stream, Encoding.get_UTF8().GetBytes(instance.Country));
            }
            if (instance.HasPreferredRegion)
            {
                stream.WriteByte(136);
                stream.WriteByte(2);
                ProtocolParser.WriteUInt32(stream, instance.PreferredRegion);
            }
        }