public static void Serialize(Stream stream, AccountSettingsNotification instance) { if (instance.Licenses.Count > 0) { foreach (AccountLicense accountLicense in instance.Licenses) { stream.WriteByte(10); ProtocolParser.WriteUInt32(stream, accountLicense.GetSerializedSize()); AccountLicense.Serialize(stream, accountLicense); } } if (instance.HasIsUsingRid) { stream.WriteByte(16); ProtocolParser.WriteBool(stream, instance.IsUsingRid); } if (instance.HasIsPlayingFromIgr) { stream.WriteByte(24); ProtocolParser.WriteBool(stream, instance.IsPlayingFromIgr); } if (instance.HasCanReceiveVoice) { stream.WriteByte(32); ProtocolParser.WriteBool(stream, instance.CanReceiveVoice); } if (instance.HasCanSendVoice) { stream.WriteByte(40); ProtocolParser.WriteBool(stream, instance.CanSendVoice); } }
public override int GetHashCode() { int num = base.GetType().GetHashCode(); using (List <AccountLicense> .Enumerator enumerator = this.Licenses.GetEnumerator()) { while (enumerator.MoveNext()) { AccountLicense current = enumerator.get_Current(); num ^= current.GetHashCode(); } } if (this.HasIsUsingRid) { num ^= this.IsUsingRid.GetHashCode(); } if (this.HasIsPlayingFromIgr) { num ^= this.IsPlayingFromIgr.GetHashCode(); } if (this.HasCanReceiveVoice) { num ^= this.CanReceiveVoice.GetHashCode(); } if (this.HasCanSendVoice) { num ^= this.CanSendVoice.GetHashCode(); } return(num); }
private void GetAccountStateCallback(RPCContext context) { if ((context == null) || (context.Payload == null)) { base.ApiLog.LogWarning("GetAccountLevelInfo invalid context!"); } else { BattleNetErrors status = (BattleNetErrors)context.Header.Status; if (status != BattleNetErrors.ERROR_OK) { object[] args = new object[] { status.ToString() }; base.ApiLog.LogError("GetAccountLevelInfo failed with error={0}", args); } else { GetAccountStateResponse response = GetAccountStateResponse.ParseFrom(context.Payload); if ((response == null) || !response.IsInitialized) { base.ApiLog.LogWarning("GetAccountStateCallback unable to parse response!"); } else if (!response.HasState || !response.State.HasAccountLevelInfo) { base.ApiLog.LogWarning("GetAccountStateCallback response has no data!"); } else { GetAccountStateRequest request = (GetAccountStateRequest)context.Request; if ((request != null) && (request.EntityId == base.m_battleNet.AccountId)) { AccountLevelInfo accountLevelInfo = response.State.AccountLevelInfo; this.m_preferredRegion = accountLevelInfo.PreferredRegion; this.m_accountCountry = accountLevelInfo.Country; object[] objArray2 = new object[] { this.m_preferredRegion }; base.ApiLog.LogDebug("Region (preferred): {0}", objArray2); object[] objArray3 = new object[] { this.m_accountCountry }; base.ApiLog.LogDebug("Country (account): {0}", objArray3); if (accountLevelInfo.LicensesList.Count > 0) { this.m_licenses.Clear(); object[] objArray4 = new object[] { accountLevelInfo.LicensesList.Count }; base.ApiLog.LogDebug("Found {0} licenses.", objArray4); for (int i = 0; i < accountLevelInfo.LicensesList.Count; i++) { AccountLicense item = accountLevelInfo.LicensesList[i]; this.m_licenses.Add(item); object[] objArray5 = new object[] { item.Id }; base.ApiLog.LogDebug("Adding license id={0}", objArray5); } } else { base.ApiLog.LogWarning("No licenses found!"); } } base.ApiLog.LogDebug("GetAccountLevelInfo, status=" + status.ToString()); } } } }
public static AccountSettingsNotification Deserialize(Stream stream, AccountSettingsNotification instance, long limit) { if (instance.Licenses == null) { instance.Licenses = new List <AccountLicense>(); } while (true) { if (limit < (long)0 || stream.Position < limit) { int num = stream.ReadByte(); if (num == -1) { if (limit >= (long)0) { throw new EndOfStreamException(); } break; } else if (num == 10) { instance.Licenses.Add(AccountLicense.DeserializeLengthDelimited(stream)); } else if (num == 16) { instance.IsUsingRid = ProtocolParser.ReadBool(stream); } else if (num == 24) { instance.IsPlayingFromIgr = ProtocolParser.ReadBool(stream); } else if (num == 32) { instance.CanReceiveVoice = ProtocolParser.ReadBool(stream); } else if (num == 40) { instance.CanSendVoice = ProtocolParser.ReadBool(stream); } else { Key key = ProtocolParser.ReadKey((byte)num, stream); if (key.Field == 0) { throw new ProtocolBufferException("Invalid field id: 0, something went wrong in the stream"); } ProtocolParser.SkipKey(stream, key); } } else { if (stream.Position != limit) { throw new ProtocolBufferException("Read past max limit"); } break; } } return(instance); }
private void GetAccountStateCallback(RPCContext context) { if (context == null || context.Payload == null) { base.ApiLog.LogWarning("GetAccountLevelInfo invalid context!"); return; } BattleNetErrors status = (BattleNetErrors)context.Header.Status; if (status != BattleNetErrors.ERROR_OK) { base.ApiLog.LogError("GetAccountLevelInfo failed with error={0}", new object[] { status.ToString() }); return; } GetAccountStateResponse getAccountStateResponse = GetAccountStateResponse.ParseFrom(context.Payload); if (getAccountStateResponse == null || !getAccountStateResponse.IsInitialized) { base.ApiLog.LogWarning("GetAccountStateCallback unable to parse response!"); return; } if (!getAccountStateResponse.HasState || !getAccountStateResponse.State.HasAccountLevelInfo) { base.ApiLog.LogWarning("GetAccountStateCallback response has no data!"); return; } GetAccountStateRequest request = (GetAccountStateRequest)context.Request; if (request != null && request.EntityId == this.m_battleNet.AccountId) { AccountLevelInfo accountLevelInfo = getAccountStateResponse.State.AccountLevelInfo; this.m_preferredRegion = accountLevelInfo.PreferredRegion; this.m_accountCountry = accountLevelInfo.Country; base.ApiLog.LogDebug("Region (preferred): {0}", new object[] { this.m_preferredRegion }); base.ApiLog.LogDebug("Country (account): {0}", new object[] { this.m_accountCountry }); if (accountLevelInfo.LicensesList.Count <= 0) { base.ApiLog.LogWarning("No licenses found!"); } else { this.m_licenses.Clear(); base.ApiLog.LogDebug("Found {0} licenses.", new object[] { accountLevelInfo.LicensesList.Count }); for (int i = 0; i < accountLevelInfo.LicensesList.Count; i++) { AccountLicense item = accountLevelInfo.LicensesList[i]; this.m_licenses.Add(item); base.ApiLog.LogDebug("Adding license id={0}", new object[] { item.Id }); } } } base.ApiLog.LogDebug(string.Concat("GetAccountLevelInfo, status=", status.ToString())); }
public bool CheckLicense(uint licenseId) { if (this.m_licenses == null || this.m_licenses.get_Count() == 0) { return(false); } using (List <AccountLicense> .Enumerator enumerator = this.m_licenses.GetEnumerator()) { while (enumerator.MoveNext()) { AccountLicense current = enumerator.get_Current(); if (current.Id == licenseId) { return(true); } } } return(false); }
public uint GetSerializedSize() { uint num = 0u; if (this.Licenses.get_Count() > 0) { using (List <AccountLicense> .Enumerator enumerator = this.Licenses.GetEnumerator()) { while (enumerator.MoveNext()) { AccountLicense current = enumerator.get_Current(); num += 1u; uint serializedSize = current.GetSerializedSize(); num += serializedSize + ProtocolParser.SizeOfUInt32(serializedSize); } } } if (this.HasIsUsingRid) { num += 1u; num += 1u; } if (this.HasIsPlayingFromIgr) { num += 1u; num += 1u; } if (this.HasCanReceiveVoice) { num += 1u; num += 1u; } if (this.HasCanSendVoice) { num += 1u; num += 1u; } return(num); }
public static void Serialize(Stream stream, AccountSettingsNotification instance) { if (instance.Licenses.get_Count() > 0) { using (List <AccountLicense> .Enumerator enumerator = instance.Licenses.GetEnumerator()) { while (enumerator.MoveNext()) { AccountLicense current = enumerator.get_Current(); stream.WriteByte(10); ProtocolParser.WriteUInt32(stream, current.GetSerializedSize()); AccountLicense.Serialize(stream, current); } } } if (instance.HasIsUsingRid) { stream.WriteByte(16); ProtocolParser.WriteBool(stream, instance.IsUsingRid); } if (instance.HasIsPlayingFromIgr) { stream.WriteByte(24); ProtocolParser.WriteBool(stream, instance.IsPlayingFromIgr); } if (instance.HasCanReceiveVoice) { stream.WriteByte(32); ProtocolParser.WriteBool(stream, instance.CanReceiveVoice); } if (instance.HasCanSendVoice) { stream.WriteByte(40); ProtocolParser.WriteBool(stream, instance.CanSendVoice); } }
public void AddLicenses(AccountLicense val) { this._Licenses.Add(val); }