예제 #1
0
 public void DisableGame(Game game)
 {
     if (game.Status == GameStatus.Activated)
     {
         UnloadGame(game);
     }
     else
     {
         throw new ArgumentOutOfRangeException(nameof(game.Status));
     }
 }
예제 #2
0
 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);
     }
 }
예제 #3
0
 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();
     }
 }
예제 #4
0
 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!");
     }
 }
예제 #5
0
 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.");
     }
 }
예제 #6
0
 private bool HasEnoughSpaceOnGameDrive(Game game)
 {
     string letter = Path.GetPathRoot(game.Path);
     return GetTotalFreeSpace(letter) > game.Size;
 }
예제 #7
0
 private bool HasEnoughSpaceOnFastDrive(Game game)
 {
     LocalDataManager ldm = new LocalDataManager();
     Config cfg = ldm.LoadConfig();
     string letter = Path.GetPathRoot(cfg.OutputPath);
     return GetTotalFreeSpace(letter) > game.Size;
 }
예제 #8
0
 protected virtual void OnDoneEnablingGame(Game game)
 {
     DoneEnablingGame?.Invoke(game);
 }