Skip to content

Commit

Permalink
Update v3.0.2.0
Browse files Browse the repository at this point in the history
  • Loading branch information
Lunaretic committed Jul 1, 2024
2 parents 4b96d40 + 85d2f66 commit 61808cb
Show file tree
Hide file tree
Showing 5 changed files with 48 additions and 10 deletions.
2 changes: 1 addition & 1 deletion FFXIV_TexTools/MainWindow.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@
</MenuItem>
<MenuItem x:Name="Menu_ImportModpack" Header="{Binding Source={x:Static resx:UIStrings.Import_ModPacks}}" Click="Menu_ImportModpack_Click"/>
<MenuItem x:Name="Menu_DisableAll" Header="{Binding Source={x:Static resx:UIStrings.Disable_All_Mods}}" Command="{Binding DisableAllModsCommand}"/>
<MenuItem x:Name="Menu_EnableAll" Header="{Binding Source={x:Static resx:UIStrings.Enable_All_Mods}}" Command="{Binding EnableAllModsCommand}"/>
<MenuItem x:Name="Menu_DeleteAll" Header="Delete All Mods" Click="Menu_StartOver_Click"/>
</MenuItem>
<MenuItem Header="{Binding Source={x:Static resx:UIStrings.View}}" StaysOpenOnClick="True">
<MenuItem x:Name="Menu_ProjectManager" Header="Project Manager" Click="Menu_ProjectManager_Click"/>
Expand Down
40 changes: 34 additions & 6 deletions FFXIV_TexTools/MainWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -1468,11 +1468,26 @@ public bool AnyUnsavedChanges()
/// </summary>
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
{

Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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))
{
Expand Down Expand Up @@ -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)
{
Expand All @@ -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)
Expand Down
1 change: 0 additions & 1 deletion FFXIV_TexTools/ViewModels/MainViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -380,7 +380,6 @@ public Visibility ProgressLabelVisible
public ICommand EnableAllModsCommand => new RelayCommand(EnableAllMods);
public ICommand DisableAllModsCommand => new RelayCommand(DisableAllMods);


/// <summary>
/// Enables all mods in the mod list
/// </summary>
Expand Down
13 changes: 12 additions & 1 deletion FFXIV_TexTools/Views/OnboardingWindow.xaml.cs
Original file line number Diff line number Diff line change
@@ -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;
Expand Down Expand Up @@ -28,6 +29,7 @@
using xivModdingFramework.Cache;
using xivModdingFramework.Helpers;
using xivModdingFramework.Models.DataContainers;
using xivModdingFramework.Mods;

namespace FFXIV_TexTools.Views
{
Expand Down Expand Up @@ -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()
Expand Down

0 comments on commit 61808cb

Please sign in to comment.