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 void Serialize(Stream stream, GetAccountResponse instance) { if (instance.HasBlob) { stream.WriteByte(90); ProtocolParser.WriteUInt32(stream, instance.Blob.GetSerializedSize()); AccountBlob.Serialize(stream, instance.Blob); } if (instance.HasId) { stream.WriteByte(98); ProtocolParser.WriteUInt32(stream, instance.Id.GetSerializedSize()); AccountId.Serialize(stream, instance.Id); } if (instance.Email.get_Count() > 0) { using (List <string> .Enumerator enumerator = instance.Email.GetEnumerator()) { while (enumerator.MoveNext()) { string current = enumerator.get_Current(); stream.WriteByte(106); ProtocolParser.WriteBytes(stream, Encoding.get_UTF8().GetBytes(current)); } } } if (instance.HasBattleTag) { stream.WriteByte(114); ProtocolParser.WriteBytes(stream, Encoding.get_UTF8().GetBytes(instance.BattleTag)); } if (instance.HasFullName) { stream.WriteByte(122); ProtocolParser.WriteBytes(stream, Encoding.get_UTF8().GetBytes(instance.FullName)); } if (instance.Links.get_Count() > 0) { using (List <GameAccountLink> .Enumerator enumerator2 = instance.Links.GetEnumerator()) { while (enumerator2.MoveNext()) { GameAccountLink current2 = enumerator2.get_Current(); stream.WriteByte(130); stream.WriteByte(1); ProtocolParser.WriteUInt32(stream, current2.GetSerializedSize()); GameAccountLink.Serialize(stream, current2); } } } if (instance.HasParentalControlInfo) { stream.WriteByte(138); stream.WriteByte(1); ProtocolParser.WriteUInt32(stream, instance.ParentalControlInfo.GetSerializedSize()); ParentalControlInfo.Serialize(stream, instance.ParentalControlInfo); } }
public static void Serialize(Stream stream, GetAccountResponse instance) { if (instance.HasBlob) { stream.WriteByte(90); ProtocolParser.WriteUInt32(stream, instance.Blob.GetSerializedSize()); AccountBlob.Serialize(stream, instance.Blob); } if (instance.HasId) { stream.WriteByte(98); ProtocolParser.WriteUInt32(stream, instance.Id.GetSerializedSize()); AccountId.Serialize(stream, instance.Id); } if (instance.Email.Count > 0) { foreach (string s in instance.Email) { stream.WriteByte(106); ProtocolParser.WriteBytes(stream, Encoding.UTF8.GetBytes(s)); } } if (instance.HasBattleTag) { stream.WriteByte(114); ProtocolParser.WriteBytes(stream, Encoding.UTF8.GetBytes(instance.BattleTag)); } if (instance.HasFullName) { stream.WriteByte(122); ProtocolParser.WriteBytes(stream, Encoding.UTF8.GetBytes(instance.FullName)); } if (instance.Links.Count > 0) { foreach (GameAccountLink gameAccountLink in instance.Links) { stream.WriteByte(130); stream.WriteByte(1); ProtocolParser.WriteUInt32(stream, gameAccountLink.GetSerializedSize()); GameAccountLink.Serialize(stream, gameAccountLink); } } if (instance.HasParentalControlInfo) { stream.WriteByte(138); stream.WriteByte(1); ProtocolParser.WriteUInt32(stream, instance.ParentalControlInfo.GetSerializedSize()); ParentalControlInfo.Serialize(stream, instance.ParentalControlInfo); } }
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 void Serialize(Stream stream) { ParentalControlInfo.Serialize(stream, this); }
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); } }
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 s in instance.Email) { stream.WriteByte(34); ProtocolParser.WriteBytes(stream, Encoding.UTF8.GetBytes(s)); } } 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 accountLicense in instance.Licenses) { stream.WriteByte(162); stream.WriteByte(1); ProtocolParser.WriteUInt32(stream, accountLicense.GetSerializedSize()); AccountLicense.Serialize(stream, accountLicense); } } if (instance.Credentials.Count > 0) { foreach (AccountCredential accountCredential in instance.Credentials) { stream.WriteByte(170); stream.WriteByte(1); ProtocolParser.WriteUInt32(stream, accountCredential.GetSerializedSize()); AccountCredential.Serialize(stream, accountCredential); } } if (instance.AccountLinks.Count > 0) { foreach (GameAccountLink gameAccountLink in instance.AccountLinks) { stream.WriteByte(178); stream.WriteByte(1); ProtocolParser.WriteUInt32(stream, gameAccountLink.GetSerializedSize()); GameAccountLink.Serialize(stream, gameAccountLink); } } 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()); 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); } }