public bool LaunchGame(GLEngine.Model.Game game) { var result = false; var command = new List <string>(); try { command = CommandParser(game.StartCommand); } catch (ArgumentException ex) { //Do something; log event!! result = false; } if (command.Count > 0) { var argString = ""; for (int i = 1; i < command.Count; i++) { argString += command[i] + " "; } var emuApp = new ProcessStartInfo(); emuApp.FileName = command[0]; emuApp.Arguments = argString; Process.Start(emuApp); result = true; } return(result); }
/// <summary> /// Ctor used when editing a game. /// </summary> /// <exception cref="NullReferenceException">Thrown if input is null</exception> /// <param name="game"></param> public EditGameViewModel(GLEngine.Model.Game game) { if (game == null) { throw new NullReferenceException("Input game cannot be null!"); } CreatingNew = false; Game = game.Clone(); ConstructorHelper(); }
public void AddingGameTest() { var gameEngine = new GLEngine.GameController(); //Create new game to add GLEngine.Model.Game newGame = GLEngine.Model.Game.CreateGame("Test game", "", ""); //Add game to controller gameEngine.AddGame(newGame); //There should be one game with the same title as the game we added. Assert.AreSame(newGame.Title, gameEngine.GetAllGames()[0].Title); }
public void RemovingGameTest() { var gameEngine = new GLEngine.GameController(); //Create a new game to add to games GLEngine.Model.Game newGame = GLEngine.Model.Game.CreateGame("Test game", "", ""); //Add game to the internal list in the gamecontroller gameEngine.AddGame(newGame); //Remove game gameEngine.RemoveGame(newGame); int gamesInInternalList = gameEngine.GetAllGames().Count; //There should be zero games in the internal game list. Assert.AreEqual(0, gamesInInternalList); }
public void EditGame(GLEngine.Model.Game game) { appstate.ChangeView(new ViewModel.EditGameViewModel(game), false); }