static void Main ( string [ ] args ) { const int ERR_NO_ARGS = 999; const int ERR_ONE_ARG = 998; const int ERR_TWO_ARG = 997; const string ERRMSG_INTERNAL = @"An internal error has occurred in the NormalExit testing block."; const string ERRMSG_NO_ARGS = @" Called without arguments. Two are required."; const string ERRMSG_ONE_ARG = @" Called with one argument. We need three of them."; const string ERRMSG_TWO_ARG = @" Called with two argument. We need three of them."; _me.DisplayBOJMessage ( ); WizardWrx.DLLServices2.Util.ShowKeyAssemblyProperties ( System.Reflection.Assembly.GetAssembly ( _me.GetType ( ) ) ); try { switch ( args.Length ) { case MagicNumbers.ZERO: NeedMoreArgs ( ERRMSG_NO_ARGS , ERR_NO_ARGS ); break; case MagicNumbers.PLUS_ONE: NeedMoreArgs ( ERRMSG_ONE_ARG , ERR_ONE_ARG ); break; case MagicNumbers.PLUS_TWO: NeedMoreArgs ( ERRMSG_TWO_ARG , ERR_TWO_ARG ); break; default: ShowArgs ( args ); ExitRules utpExitRulesMap = EvaluateArguments ( args ); switch ( utpExitRulesMap.Disposition ) { case ExitCodeDisposition.PassAsArg: _me.NormalExit ( utpExitRulesMap.ExitCode , utpExitRulesMap.Action ); break; case ExitCodeDisposition.StoreInMy: _me.BaseStateManager.AppReturnCode = ( int ) utpExitRulesMap.ExitCode; _me.NormalExit ( utpExitRulesMap.Action ); break; default: throw new Exception ( ERRMSG_INTERNAL ); } // switch ( utpExitRulesMap.Disposition ) break; } // switch ( args.Length ) } // The normal execution path ends here. catch ( Exception errAllKinds ) { _me.BaseStateManager.AppExceptionLogger.ReportException ( errAllKinds ); _me.DisplayEOJMessage ( ); } } // static void Main
public async Task <ExitRules> Exit(ClaimsPrincipal cl) { User user = await _userManager.GetUserAsync(cl); if (user == null) { return(ExitRules.NoAuth); } ExitRules state = CanPlayerExit(user); switch (state) { case ExitRules.Ok: Information.RemovePlayer(user); user.Money += Information.Rate; await _userManager.UpdateAsync(user); await _gameHub.Clients.Group(Information.Identifier.ToString()).SendAsync("PlayerExit", user.UserName); break; } return(state); }
public int Exit(int Identifier) { Game game = _gamesService.getGame(Identifier); if (game == null) { return(-1); } ExitRules result = game.Exit(HttpContext.User).Result; return((int)result); }