public void GetPlayRestrictions(ref Lockouts restrictions, bool reload) { if (!reload) { if (this.LastGameSessionInfo != null) { restrictions.loaded = true; restrictions.sessionStartTime = this.LastGameSessionInfo.SessionStartTime; return; } if (this.GameSessionRunningCount > 0) { return; } } this.LastGameSessionInfo = null; AccountAPI gameSessionRunningCount = this; gameSessionRunningCount.GameSessionRunningCount = gameSessionRunningCount.GameSessionRunningCount + 1; GetGameSessionInfoRequest getGameSessionInfoRequest = new GetGameSessionInfoRequest(); getGameSessionInfoRequest.SetEntityId(this.m_battleNet.GameAccountId); AccountAPI.GetGameSessionInfoRequestContext getGameSessionInfoRequestContext = new AccountAPI.GetGameSessionInfoRequestContext(this); this.m_rpcConnection.QueueRequest(this.m_accountService.Id, 34, getGameSessionInfoRequest, new RPCContextDelegate(getGameSessionInfoRequestContext.GetGameSessionInfoRequestContextCallback), 0); }
public void GetGameSessionInfoRequestContextCallback(RPCContext context) { AccountAPI mParent = this.m_parent; mParent.GameSessionRunningCount = mParent.GameSessionRunningCount - 1; if (context == null || context.Payload == null) { this.m_parent.ApiLog.LogWarning("GetPlayRestrictions invalid context!"); return; } BattleNetErrors status = (BattleNetErrors)context.Header.Status; if (status != BattleNetErrors.ERROR_OK) { this.m_parent.ApiLog.LogError("GetPlayRestrictions failed with error={0}", new object[] { status.ToString() }); return; } GetGameSessionInfoResponse getGameSessionInfoResponse = GetGameSessionInfoResponse.ParseFrom(context.Payload); if (getGameSessionInfoResponse == null || !getGameSessionInfoResponse.IsInitialized) { this.m_parent.ApiLog.LogWarning("GetPlayRestrictions unable to parse response!"); return; } if (!getGameSessionInfoResponse.HasSessionInfo) { this.m_parent.ApiLog.LogWarning("GetPlayRestrictions response has no data!"); return; } this.m_parent.LastGameSessionInfo = new AccountAPI.GameSessionInfo(); if (!getGameSessionInfoResponse.SessionInfo.HasStartTime) { this.m_parent.ApiLog.LogWarning("GetPlayRestrictions response has no HasStartTime!"); } else { this.m_parent.LastGameSessionInfo.SessionStartTime = (ulong)getGameSessionInfoResponse.SessionInfo.StartTime; } }
public GetGameSessionInfoRequestContext(AccountAPI parent) { this.m_parent = parent; }