Exemplo n.º 1
0
        public async Task <DeleteLaunchResult> WaitForGameLaunchEndedAndRecordAsync()
        {
            IAction            action = _actionRecorder.CreateToolAction(ActionType.GameLaunchWaitForEnd);
            DeleteLaunchResult result = null;

            async Task WaitAndRecordTask()
            {
                result = await _gameLaunchBeHelper.WaitUntilGameLaunchEndedAsync(
                    LaunchName, new NothingToCancel(), action);

                EndReason?eReason = result.DeletedLaunch?.GameLaunchEnded?.EndReason;
                var       endData = new DeveloperLogEvent
                {
                    GameLaunchData = new GameLaunchData
                    {
                        LaunchId = LaunchId, EndReason = (int?)eReason
                    }
                };

                action.UpdateEvent(endData);
                if (eReason.HasValue && eReason != EndReason.GameExitedWithSuccessfulCode)
                {
                    throw new GameLaunchFailError("Game stopped due to unexpected reason.");
                }
            }

            await action.RecordAsync(WaitAndRecordTask());

            return(result);
        }
Exemplo n.º 2
0
        public async Task <DeleteLaunchResult> DeleteLaunchAsync(
            string gameLaunchName, ICancelable task, IAction action)
        {
            try
            {
                await _gameletClient.DeleteGameLaunchAsync(gameLaunchName, action);
            }
            catch (CloudException e) when((e.InnerException as RpcException)?.StatusCode ==
                                          StatusCode.NotFound)
            {
                // There is no launch with the specified name.
                return(DeleteLaunchResult.Success(null));
            }

            return(await WaitUntilGameLaunchEndedAsync(gameLaunchName, task, action));
        }