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 uint GetSerializedSize() { uint num = 0u; if (this.HasBlob) { num += 1u; uint serializedSize = this.Blob.GetSerializedSize(); num += serializedSize + ProtocolParser.SizeOfUInt32(serializedSize); } if (this.HasId) { num += 1u; uint serializedSize2 = this.Id.GetSerializedSize(); num += serializedSize2 + ProtocolParser.SizeOfUInt32(serializedSize2); } if (this.Email.get_Count() > 0) { using (List <string> .Enumerator enumerator = this.Email.GetEnumerator()) { while (enumerator.MoveNext()) { string current = enumerator.get_Current(); num += 1u; uint byteCount = (uint)Encoding.get_UTF8().GetByteCount(current); num += ProtocolParser.SizeOfUInt32(byteCount) + byteCount; } } } if (this.HasBattleTag) { num += 1u; uint byteCount2 = (uint)Encoding.get_UTF8().GetByteCount(this.BattleTag); num += ProtocolParser.SizeOfUInt32(byteCount2) + byteCount2; } if (this.HasFullName) { num += 1u; uint byteCount3 = (uint)Encoding.get_UTF8().GetByteCount(this.FullName); num += ProtocolParser.SizeOfUInt32(byteCount3) + byteCount3; } if (this.Links.get_Count() > 0) { using (List <GameAccountLink> .Enumerator enumerator2 = this.Links.GetEnumerator()) { while (enumerator2.MoveNext()) { GameAccountLink current2 = enumerator2.get_Current(); num += 2u; uint serializedSize3 = current2.GetSerializedSize(); num += serializedSize3 + ProtocolParser.SizeOfUInt32(serializedSize3); } } } if (this.HasParentalControlInfo) { num += 2u; uint serializedSize4 = this.ParentalControlInfo.GetSerializedSize(); num += serializedSize4 + ProtocolParser.SizeOfUInt32(serializedSize4); } return(num); }
public uint GetSerializedSize() { uint num = 0u; num += 4u; num += ProtocolParser.SizeOfUInt32(this.Region); if (this.Email.get_Count() > 0) { using (List <string> .Enumerator enumerator = this.Email.GetEnumerator()) { while (enumerator.MoveNext()) { string current = enumerator.get_Current(); num += 1u; uint byteCount = (uint)Encoding.get_UTF8().GetByteCount(current); num += ProtocolParser.SizeOfUInt32(byteCount) + byteCount; } } } num += ProtocolParser.SizeOfUInt64(this.Flags); if (this.HasSecureRelease) { num += 1u; num += ProtocolParser.SizeOfUInt64(this.SecureRelease); } if (this.HasWhitelistStart) { num += 1u; num += ProtocolParser.SizeOfUInt64(this.WhitelistStart); } if (this.HasWhitelistEnd) { num += 1u; num += ProtocolParser.SizeOfUInt64(this.WhitelistEnd); } uint byteCount2 = (uint)Encoding.get_UTF8().GetByteCount(this.FullName); num += ProtocolParser.SizeOfUInt32(byteCount2) + byteCount2; if (this.Licenses.get_Count() > 0) { using (List <AccountLicense> .Enumerator enumerator2 = this.Licenses.GetEnumerator()) { while (enumerator2.MoveNext()) { AccountLicense current2 = enumerator2.get_Current(); num += 2u; uint serializedSize = current2.GetSerializedSize(); num += serializedSize + ProtocolParser.SizeOfUInt32(serializedSize); } } } if (this.Credentials.get_Count() > 0) { using (List <AccountCredential> .Enumerator enumerator3 = this.Credentials.GetEnumerator()) { while (enumerator3.MoveNext()) { AccountCredential current3 = enumerator3.get_Current(); num += 2u; uint serializedSize2 = current3.GetSerializedSize(); num += serializedSize2 + ProtocolParser.SizeOfUInt32(serializedSize2); } } } if (this.AccountLinks.get_Count() > 0) { using (List <GameAccountLink> .Enumerator enumerator4 = this.AccountLinks.GetEnumerator()) { while (enumerator4.MoveNext()) { GameAccountLink current4 = enumerator4.get_Current(); num += 2u; uint serializedSize3 = current4.GetSerializedSize(); num += serializedSize3 + ProtocolParser.SizeOfUInt32(serializedSize3); } } } if (this.HasBattleTag) { num += 2u; uint byteCount3 = (uint)Encoding.get_UTF8().GetByteCount(this.BattleTag); num += ProtocolParser.SizeOfUInt32(byteCount3) + byteCount3; } if (this.HasDefaultCurrency) { num += 2u; num += 4u; } if (this.HasLegalRegion) { num += 2u; num += ProtocolParser.SizeOfUInt32(this.LegalRegion); } if (this.HasLegalLocale) { num += 2u; num += 4u; } num += ProtocolParser.SizeOfUInt64(this.CacheExpiration); if (this.HasParentalControlInfo) { num += 2u; uint serializedSize4 = this.ParentalControlInfo.GetSerializedSize(); num += serializedSize4 + ProtocolParser.SizeOfUInt32(serializedSize4); } if (this.HasCountry) { num += 2u; uint byteCount4 = (uint)Encoding.get_UTF8().GetByteCount(this.Country); num += ProtocolParser.SizeOfUInt32(byteCount4) + byteCount4; } if (this.HasPreferredRegion) { num += 2u; num += ProtocolParser.SizeOfUInt32(this.PreferredRegion); } num += 6u; return(num); }
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); } }