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, 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); } }
public void Serialize(Stream stream) { GameAccountLink.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); } }