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()); } } } }
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())); }
private void HandleAccountNotify_AccountStateUpdated(RPCContext context) { if (context == null || context.Payload == null) { base.ApiLog.LogWarning("HandleAccountNotify_AccountStateUpdated invalid context!"); return; } AccountStateNotification accountStateNotification = AccountStateNotification.ParseFrom(context.Payload); if (accountStateNotification == null || !accountStateNotification.IsInitialized) { base.ApiLog.LogWarning("HandleAccountNotify_AccountStateUpdated unable to parse response!"); return; } if (!accountStateNotification.HasState) { base.ApiLog.LogDebug("HandleAccountNotify_AccountStateUpdated HasState=false, data={0}", new object[] { accountStateNotification }); return; } AccountState state = accountStateNotification.State; if (!state.HasAccountLevelInfo) { base.ApiLog.LogDebug("HandleAccountNotify_AccountStateUpdated HasAccountLevelInfo=false, data={0}", new object[] { accountStateNotification }); return; } AccountLevelInfo accountLevelInfo = state.AccountLevelInfo; if (!accountLevelInfo.HasPreferredRegion) { base.ApiLog.LogDebug("HandleAccountNotify_AccountStateUpdated HasPreferredRegion=false, data={0}", new object[] { accountStateNotification }); return; } base.ApiLog.LogDebug("HandleAccountNotify_AccountStateUpdated, data={0}", new object[] { accountStateNotification }); }