Example #1
0
 /// <summary>
 /// Validates and stores the installation paths for games to be processed
 /// </summary>
 /// <param name="gameTitle">The name of the game to validate</param>
 public static void ValidateINI(string gameTitle)
 {
     const string iniSection = "Game Paths";
     GameInfo game = GameInfo.GetGamebyProp(gameTitle);
     INIFile ini = new INIFile(Globals.Paths.ConfigurationFile);
     if (!File.Exists(Globals.Paths.ConfigurationFile))
     {
         InitINI();
     }
     if (!Directory.Exists(ini.INIReadValue(iniSection, game.Title)))
     {
         Console.WriteLine("Finding {0}", game.Title);
         foreach (string drive in Globals.Paths.Drives)
         {
             Parallel.ForEach(EnumerateFiles(drive, game.Binary, SearchOption.AllDirectories), matchedFile =>
             {
                 Console.WriteLine("Found {0}", matchedFile);
                 string leafPath = matchedFile;
                 for (int i = 0; i < game.Leaf; ++i)
                 {
                     leafPath = Directory.GetParent(leafPath).ToString();
                 }
                 ini.INIWriteValue(iniSection, game.Title, leafPath + @"\");
                 Console.WriteLine("Storing {0}", leafPath + @"\");
             });
         }
     }
 }
Example #2
0
 /// <summary>
 /// Creates a preconfigured INI file according to Kurouzu.Defaults
 /// </summary>
 public static void InitINI()
 {
     Console.Write("This is your first time running Kurouzu. Configuring.");
     const string iniSection = "Game Paths";
     INIFile ini = new INIFile(Globals.Paths.ConfigurationFile);
     Parallel.ForEach(Globals.Games, game =>
     {
         ini.INIWriteValue(iniSection, game.Title, game.Source);
         foreach (KeyValuePair<string, string> dimension in game.Dimensions)
         {
             ini.INIWriteValue(game.Title, dimension.Key, dimension.Value);
         }
     });
     Console.WriteLine(".Done! :)");
 }