diff --git a/FFXIV_TexTools/MainWindow.xaml b/FFXIV_TexTools/MainWindow.xaml index f9b1e86f..c288e561 100644 --- a/FFXIV_TexTools/MainWindow.xaml +++ b/FFXIV_TexTools/MainWindow.xaml @@ -69,7 +69,7 @@ - + diff --git a/FFXIV_TexTools/MainWindow.xaml.cs b/FFXIV_TexTools/MainWindow.xaml.cs index a434b737..1b483894 100644 --- a/FFXIV_TexTools/MainWindow.xaml.cs +++ b/FFXIV_TexTools/MainWindow.xaml.cs @@ -521,7 +521,7 @@ await Task.Run(async () => // Disable cache worker entirely for now. - await XivCache.SetGameInfo(gameDir, lang, false); + await XivCache.SetGameInfo(gameDir, lang, true); CustomizeViewModel.UpdateCacheSettings(); } catch(Exception ex) @@ -1468,11 +1468,26 @@ public bool AnyUnsavedChanges() /// private async void Menu_StartOver_Click(object sender, RoutedEventArgs e) { - if(!this.CheckUnsafeOperation(true, true)) + var lastWriteMode = XivCache.GameWriteEnabled; + if(!XivCache.GameWriteEnabled) { - return; + var r = FlexibleMessageBox.Show(ViewHelpers.GetWin32Window(this), "You are currently in SAFE mode. To proceed, UNSAFE mode must be activated.\n\nThis will alter your real/live game files if you continue.", "Safe Mod Toggle Prompt",MessageBoxButtons.OKCancel, MessageBoxIcon.Warning); + if(r != System.Windows.Forms.DialogResult.OK) + { + return; + } + } + + if (MainWindow.UserTransaction != null) + { + if(MainWindow.UserTransaction.ModifiedFiles.Count > 0) + { + var r = FlexibleMessageBox.Show(ViewHelpers.GetWin32Window(this), "Your current transaction must be closed in order to proceed.\n\nYou will lose any active changes if you continue.", "Transaction Cancel Warning", MessageBoxButtons.OKCancel, MessageBoxIcon.Warning); + } + await ModTransaction.CancelTransaction(MainWindow.UserTransaction, true); } + XivCache.GameWriteEnabled = true; try { @@ -1539,6 +1554,10 @@ private async void Menu_StartOver_Click(object sender, RoutedEventArgs e) { this.ShowError(UIMessages.StartOverErrorTitle, "An unhandled error occurred when Starting Over:\n\n" + ex.Message); } + finally + { + XivCache.GameWriteEnabled = lastWriteMode; + } } private void Menu_Donate_Click(object sender, RoutedEventArgs e) @@ -1568,7 +1587,6 @@ private async void Menu_Backup_Click(object sender, RoutedEventArgs e) if (result == System.Windows.Forms.DialogResult.Yes) { - var gameDirectory = new DirectoryInfo(Settings.Default.FFXIV_Directory); var backupsDirectory = new DirectoryInfo(Properties.Settings.Default.Backup_Directory); await LockUi("Backing Up Indexes".L(), "Please wait...".L()); try @@ -1709,6 +1727,7 @@ private async void Menu_WebBackups_Click(object sender, RoutedEventArgs e) } private async Task DownloadIndexBackups() { + var success = false; var url = UIStrings.Index_Backups_Url; if (url == "NONE" || String.IsNullOrWhiteSpace(url)) { @@ -1758,10 +1777,10 @@ await Task.Run(async () => _lockProgress.Report("Copying new indexes to backup directory...".L()); await IOUtil.UnzipFiles(zipPath, Settings.Default.Backup_Directory); - _lockProgress.Report("Job Done.".L()); + success = true; }); - FlexibleMessageBox.Show("Successfully downloaded fresh index backups.\nYou may now use [Start Over] to apply them, if desired.".L(), "Backup Download Success".L(), MessageBoxButtons.OK, MessageBoxIcon.Information, MessageBoxDefaultButton.Button1); + } catch(Exception Ex) { @@ -1776,6 +1795,15 @@ await Task.Run(async () => } await UnlockUi(); } + if (success) + { + var res = (FlexibleMessageBox.Show("Successfully downloaded fresh index backups.\nWould you like to delete all mods and apply these backups/[Start Over]?.".L(), "Backup Download Success".L(), MessageBoxButtons.YesNo, MessageBoxIcon.Information, MessageBoxDefaultButton.Button1)); + if (res == System.Windows.Forms.DialogResult.Yes) + { + _lockProgressController.SetTitle("Removing All Mods"); + Menu_StartOver_Click(null, null); + } + } } private void Menu_CopyFile_Click(object sender, RoutedEventArgs e) diff --git a/FFXIV_TexTools/ViewModels/MainViewModel.cs b/FFXIV_TexTools/ViewModels/MainViewModel.cs index dba9f364..8663fb88 100644 --- a/FFXIV_TexTools/ViewModels/MainViewModel.cs +++ b/FFXIV_TexTools/ViewModels/MainViewModel.cs @@ -380,7 +380,6 @@ public Visibility ProgressLabelVisible public ICommand EnableAllModsCommand => new RelayCommand(EnableAllMods); public ICommand DisableAllModsCommand => new RelayCommand(DisableAllMods); - /// /// Enables all mods in the mod list /// diff --git a/FFXIV_TexTools/Views/OnboardingWindow.xaml.cs b/FFXIV_TexTools/Views/OnboardingWindow.xaml.cs index cf1fe6a7..e5f0eebf 100644 --- a/FFXIV_TexTools/Views/OnboardingWindow.xaml.cs +++ b/FFXIV_TexTools/Views/OnboardingWindow.xaml.cs @@ -1,4 +1,5 @@ -using FFXIV_TexTools.Helpers; +using FFXIV_TexTools.Annotations; +using FFXIV_TexTools.Helpers; using FFXIV_TexTools.Properties; using FFXIV_TexTools.Resources; using FolderSelect; @@ -28,6 +29,7 @@ using xivModdingFramework.Cache; using xivModdingFramework.Helpers; using xivModdingFramework.Models.DataContainers; +using xivModdingFramework.Mods; namespace FFXIV_TexTools.Views { @@ -185,6 +187,15 @@ public static void OnboardAndInitialize() InitializeSettings(); CheckRerunAdmin(); + ValidateModlist(); + } + + public static void ValidateModlist() + { + if (!Modding.ValidateModlist(Settings.Default.FFXIV_Directory)) + { + ViewHelpers.ShowWarning(MainWindow.GetMainWindow(), "Invalid Modlist Error", "The Modlist file was invalid, corrupt, or from an incompatible TexTools version, and will be removed.\n\nPlease use Help => Download Index Backups/Start Over after TexTools has finished starting."); + } } public static bool IsRunningAsAdministrator() diff --git a/lib/xivModdingFramework b/lib/xivModdingFramework index aaa28acb..a2c076ff 160000 --- a/lib/xivModdingFramework +++ b/lib/xivModdingFramework @@ -1 +1 @@ -Subproject commit aaa28acb7bd05c230d7fc62bad64f3ef4070a4a7 +Subproject commit a2c076ff7f7d76c4a6fb14feacd42fc4515f5ef0