public void DisableGame(Game game) { if (game.Status == GameStatus.Activated) { UnloadGame(game); } else { throw new ArgumentOutOfRangeException(nameof(game.Status)); } }
private void GameControllerOnDoneEnablingGame(Game game) { if (folderGridView.InvokeRequired) { folderGridView.Invoke(new Action(() => GameControllerOnDoneEnablingGame(game))); } else { game.Status = GameStatus.Activated; workingProgress = WorkingProgress.BusyDoingNothing; folderGridView.Refresh(); statusToolStripLabel.Text = "Ready!"; SaveData(); folderGridView_CurrentCellChanged(null, null); } }
private void AdderOnDataReady(string path, long size, int count, string name) { if (folderGridView.InvokeRequired) { folderGridView.BeginInvoke(new Action(() => AdderOnDataReady(path, size, count, name))); } else { Game game = new Game(path, name, size, count); // Don't add a game already in the list if (Games.Any(g => g.Path.Equals(game.Path))) return; if (game.Path.EndsWith(".oldGameLoader")) return; Games.Add(game); SaveData(); folderGridView.Refresh(); } }
private void UnloadGame(Game game) { currentGame = game; if (HasEnoughSpaceOnGameDrive(game)) { using (BackgroundWorker bw = new BackgroundWorker()) { bw.DoWork += BackgroundWorkerUnloadGame; bw.RunWorkerAsync(); } } else { MessageBox.Show("You do not have enough space on your gamedrive to unload the game!"); } }
private void LoadGame(Game game) { currentGame = game; if (HasEnoughSpaceOnFastDrive(game)) { using (BackgroundWorker bw = new BackgroundWorker()) { bw.DoWork += BackgroundWorkerLoadGame; bw.RunWorkerAsync(); } } else { MessageBox.Show("You do not have enough free space on your fast harddisk to load this game."); } }
private bool HasEnoughSpaceOnGameDrive(Game game) { string letter = Path.GetPathRoot(game.Path); return GetTotalFreeSpace(letter) > game.Size; }
private bool HasEnoughSpaceOnFastDrive(Game game) { LocalDataManager ldm = new LocalDataManager(); Config cfg = ldm.LoadConfig(); string letter = Path.GetPathRoot(cfg.OutputPath); return GetTotalFreeSpace(letter) > game.Size; }
protected virtual void OnDoneEnablingGame(Game game) { DoneEnablingGame?.Invoke(game); }