SaveConfig() public method

public SaveConfig ( Config config ) : void
config Config
return void
Ejemplo n.º 1
0
 private void LoadConfig()
 {
     LocalDataManager ldm = new LocalDataManager();
     Config cfg = ldm.LoadConfig();
     fastFolderTextBox.Text = cfg.OutputPath;
     if (cfg.FirstRun)
     {
         cfg.FirstRun = false;
         ldm.SaveConfig(cfg);
         using (BackgroundWorker bw = new BackgroundWorker())
         {
             bw.DoWork += BackgroundWorkerScanForGames;
             bw.RunWorkerAsync();
         }
     }
     else
     {
         SearchFoldersForGames(cfg.GamesFolders);
     }
 }
Ejemplo n.º 2
0
 private void saveFastFolderButton_Click(object sender, EventArgs e)
 {
     if (Games.Any(g => g.Status != GameStatus.Deactivated))
     {
         MessageBox.Show("Not all games are deactivated, please do this first!");
         return;
     }
     string text = fastFolderTextBox.Text;
     if (string.IsNullOrWhiteSpace(text))
     {
         MessageBox.Show("You have to enter a path");
         return;
     }
     if (File.Exists(text))
     {
         MessageBox.Show("There is a file at this path. It is therefor not valid");
         return;
     }
     if (!Directory.Exists(text))
     {
         DialogResult result = MessageBox.Show("The destination folder does not exist, do you want me to create it?", "Directory not found", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
         if (result == DialogResult.Yes)
             Directory.CreateDirectory(text);
         else
             return;
     }
     LocalDataManager ldm = new LocalDataManager();
     Config cfg = ldm.LoadConfig();
     cfg.OutputPath = text;
     ldm.SaveConfig(cfg);
 }
Ejemplo n.º 3
0
 private void BackgroundWorkerScanForGames(object sender, DoWorkEventArgs doWorkEventArgs)
 {
     workingProgress = WorkingProgress.ScanningForGames;
     var ldm = new LocalDataManager();
     var cfg = ldm.LoadConfig();
     DialogResult result =
             MessageBox.Show(
                 "This is the first time you are running GameLoader, do you want it to check for installed games?",
                 "Check for games", MessageBoxButtons.YesNo);
     List<string> fs = cfg.GamesFolders;
     if (result == DialogResult.Yes)
     {
         string[] paths = GameSuggestions.GetGameFolders();
         string question = "I found these paths: " + Environment.NewLine + string.Join(Environment.NewLine, paths) + Environment.NewLine + "Do you want to use them?" + Environment.NewLine + "You can add other folders to auto-discovery later if you want. ";
         result = MessageBox.Show(question, "Found paths", MessageBoxButtons.YesNo);
         if (result == DialogResult.Yes)
         {
             fs.AddRange(paths.Distinct());
         }
     }
     ldm.SaveConfig(cfg);
     SearchFoldersForGames(fs);
 }