/// <summary> /// Checks the dat counts in the index file /// </summary> /// <returns>Flag for problem found</returns> private bool CheckIndexDatCounts() { var problemFound = false; var filesToCheck = new XivDataFile[] { XivDataFile._0A_Exd, XivDataFile._01_Bgcommon, XivDataFile._04_Chara, XivDataFile._06_Ui }; foreach (var file in filesToCheck) { AddText($"\t{file.GetDataFileName()} Index Files", textColor); var result = _problemChecker.CheckIndexDatCounts(file); if (result) { _indexDatRepairList.Add(file); AddText("\t\u2716\n", "Red"); problemFound = true; } else { AddText("\t\u2714\n", "Green"); } } return(problemFound); }
public bool ValidateIndexFiles() { bool keepGoing = true; if (MainClass._gameDirectory != null) { string modlistPath = Path.Combine(MainClass._gameDirectory.FullName, "XivMods.json"); if (!File.Exists(modlistPath)) { ProblemChecker problemChecker = new ProblemChecker(MainClass._indexDirectory); var filesToCheck = new XivDataFile[] { XivDataFile._0A_Exd, XivDataFile._01_Bgcommon, XivDataFile._04_Chara, XivDataFile._06_Ui }; bool modifiedIndex = false; foreach (var file in filesToCheck) { var datCountCheck = problemChecker.CheckIndexDatCounts(file); datCountCheck.Wait(); if (datCountCheck.Result) { modifiedIndex = true; break; } } if (modifiedIndex) { main.PrintMessage("HERE BE DRAGONS\nPreviously modified game files found\nUse the originally used tool to start over, or reinstall the game before using this tool", 2); keepGoing = PromptContinuation(); } } else { var modData = JsonConvert.DeserializeObject <ModList>(File.ReadAllText(modlistPath)); bool unsupportedSource = false; string unknownSource = ""; //List of acceptable mod sources //FFXIV_Modding_Tool is used by this tool //FilesAddedByTexTools is hardcoded in the framework and is used in certain situations //BLANK seems to be caused by a framework bug as well, so we allow it List <string> acceptedSourcesList = new List <string> { "FFXIV_Modding_Tool", "FilesAddedByTexTools", "_INTERNAL_", "" }; foreach (Mod mod in modData.Mods) { if (!acceptedSourcesList.Contains(mod.source)) { unknownSource = mod.source; unsupportedSource = true; break; } } if (unsupportedSource) { main.PrintMessage($"Found a mod applied by an unknown application, game stability cannot be guaranteed: {unknownSource}", 3); keepGoing = PromptContinuation(); } } } return(keepGoing); }
private async Task CheckIndexFiles() { var xivDataFiles = new XivDataFile[] { XivDataFile._0A_Exd, XivDataFile._01_Bgcommon, XivDataFile._04_Chara, XivDataFile._06_Ui }; var problemChecker = new ProblemChecker(_gameDirectory); foreach (var xivDataFile in xivDataFiles) { var errorFound = await problemChecker.CheckIndexDatCounts(xivDataFile); if (errorFound) { await problemChecker.RepairIndexDatCounts(xivDataFile); } } }
/// <summary> /// Checks the dat counts in the index file /// </summary> /// <returns>Flag for problem found</returns> private async Task <bool> CheckIndexDatCounts() { var problemFound = false; var filesToCheck = new XivDataFile[] { XivDataFile._0A_Exd, XivDataFile._01_Bgcommon, XivDataFile._04_Chara, XivDataFile._06_Ui }; foreach (var file in filesToCheck) { AddText($"\t{file.GetDataFileName()} Index Files", textColor); try { var result = await _problemChecker.CheckIndexDatCounts(file); if (result) { _indexDatRepairList.Add(file); AddText("\t\u2716\t", "Red"); problemFound = true; } else { AddText("\t\u2714\t", "Green"); } result = await _problemChecker.CheckForLargeDats(file); if (result) { AddText($"\t\u2716\n{UIStrings.ProblemCheck_ExtraDats}\n", "Red"); problemFound = true; } else { AddText("\t\u2714\n", "Green"); } } catch (Exception ex) { FlexibleMessageBox.Show( $"{UIMessages.ProblemCheckDatIssueMessage}\n{ex.Message}", UIMessages.ProblemCheckErrorTitle, MessageBoxButtons.OK, MessageBoxIcon.Error); } } return(problemFound); }
private async Task <bool> CheckIndexFiles() { var xivDataFiles = new XivDataFile[] { XivDataFile._0A_Exd, XivDataFile._01_Bgcommon, XivDataFile._04_Chara, XivDataFile._06_Ui }; var problemChecker = new ProblemChecker(_gameDirectory); try { foreach (var xivDataFile in xivDataFiles) { var errorFound = await problemChecker.CheckIndexDatCounts(xivDataFile); if (errorFound) { await problemChecker.RepairIndexDatCounts(xivDataFile); } } } catch (Exception ex) { var result = FlexibleMessageBox.Show("A critical error occurred when attempting to read the FFXIV index files.\n\nWould you like to restore your index backups?\n\nError: " + ex.Message, "Critical Index Error", MessageBoxButtons.YesNo, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1); if (result == DialogResult.Yes) { var indexBackupsDirectory = new DirectoryInfo(Settings.Default.Backup_Directory); var success = await problemChecker.RestoreBackups(indexBackupsDirectory); if (!success) { FlexibleMessageBox.Show("Unable to restore Index Backups, shutting down TexTools.", "Critical Error Shutdown", MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1); return(false); } } else { FlexibleMessageBox.Show("Shutting Down TexTools.", "Critical Error Shutdown", MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1); return(false); } } return(true); }