private void ExtractMergedGameData() { Console.Write("Loading game data..."); GameData gameData = new CASCGameData(CASCHotsStorage.CASCHandler, CASCHotsStorage.CASCFolderRoot, HotsBuild) { IsCacheEnabled = true, }; gameData.LoadXmlFiles(); // load up gamestrings foreach (Localization localization in GetLocalizations()) { gameData.GameStringLocalization = localization.GetFriendlyName(); gameData.LoadGamestringFiles(); } Console.WriteLine("Done."); // existing directory checks string texturesDirectory = Path.Combine(OutputDirectory, CASCTexturesPath); string modsHotsBuildTexturesDirectory = Path.Combine(OutputDirectory, $"mods_{HotsBuild}", CASCTexturesPathNoMods); if (TextureExtraction) { DeleteExistingDirectory(texturesDirectory); DeleteExistingDirectory(modsHotsBuildTexturesDirectory); } Stopwatch time = new Stopwatch(); time.Start(); Console.WriteLine(); Console.WriteLine("Extracting files..."); gameData.XmlGameData.Save(Path.Combine(OutputDirectory, "xmlgamedata.xml"), SaveOptions.None); Console.WriteLine("xmlgamedata.xml"); ExtractFiles(gameData.TextCachedFilePaths, gameData.TextCachedFilePathCount, "text files"); if (TextureExtraction) { List <string> textFilesList = GetTextureFiles(); ExtractFiles(textFilesList, textFilesList.Count, "texture files"); if (Directory.Exists(texturesDirectory)) { Directory.Move(texturesDirectory, modsHotsBuildTexturesDirectory); } } time.Stop(); Console.WriteLine($"Extraction took {time.Elapsed.TotalSeconds} seconds"); }
private void ExtractGameData() { Console.Write("Loading game data..."); GameData gameData = new CASCGameData(CASCHotsStorage.CASCHandler, CASCHotsStorage.CASCFolderRoot, HotsBuild) { IsCacheEnabled = true, }; gameData.LoadXmlFiles(); // load up gamestrings foreach (Localization localization in GetLocalizations()) { gameData.GameStringLocalization = localization.GetFriendlyName(); gameData.LoadGamestringFiles(); } Console.WriteLine("Done."); // existing directory checks string defaultDirectory = Path.Combine(OutputDirectory, "mods"); string modsHotsBuildDirectory = Path.Combine(OutputDirectory, $"mods_{HotsBuild}"); DeleteExistingDirectory(defaultDirectory); DeleteExistingDirectory(modsHotsBuildDirectory); Stopwatch time = new Stopwatch(); time.Start(); Console.WriteLine(); Console.WriteLine("Extracting files..."); ExtractFiles(gameData.XmlCachedFilePaths, gameData.XmlCachedFilePathCount, "xml files"); ExtractFiles(gameData.TextCachedFilePaths, gameData.TextCachedFilePathCount, "text files"); ExtractFiles(gameData.StormStyleCachedFilePath, gameData.StormStyleCachedFilePathCount, "storm style files"); if (TextureExtraction) { List <string> textFilesList = GetTextureFiles(); ExtractFiles(textFilesList, textFilesList.Count, "texture files"); } if (Directory.Exists(defaultDirectory)) { try { Directory.Move(defaultDirectory, modsHotsBuildDirectory); } catch (IOException ex) { Console.ForegroundColor = ConsoleColor.Red; Console.WriteLine($"An error occured -> {ex.Message}"); Console.WriteLine($"Manually delete the existing directory at {modsHotsBuildDirectory} and try again"); Console.ResetColor(); } } time.Stop(); Console.WriteLine($"Extraction took {time.Elapsed.TotalSeconds} seconds"); }