From 918b331a85ebf0cf7491e65375e91e36e258973c Mon Sep 17 00:00:00 2001 From: Benjamin Date: Sat, 22 Nov 2025 12:57:20 -0600 Subject: [PATCH] Fixed .7z file installation --- .../ShinRyuModManager-CE.csproj | 2 +- .../UserInterface/Assets/changelog.md | 9 ++++ .../ViewModels/ProgressWindowViewModel.cs | 4 +- .../UserInterface/Views/MainWindow.axaml.cs | 47 ++++++++++++------- .../UserInterface/Views/ProgressWindow.axaml | 6 ++- .../Views/ProgressWindow.axaml.cs | 24 ++++++---- ShinRyuModManager-CE/Utils.cs | 27 ++++++++++- 7 files changed, 89 insertions(+), 30 deletions(-) diff --git a/ShinRyuModManager-CE/ShinRyuModManager-CE.csproj b/ShinRyuModManager-CE/ShinRyuModManager-CE.csproj index c23299a..ce944ff 100644 --- a/ShinRyuModManager-CE/ShinRyuModManager-CE.csproj +++ b/ShinRyuModManager-CE/ShinRyuModManager-CE.csproj @@ -14,7 +14,7 @@ true - 1.2.4 + 1.2.5 $(AssemblyVersion) ShinRyuModManager-CE SRMM Studio diff --git a/ShinRyuModManager-CE/UserInterface/Assets/changelog.md b/ShinRyuModManager-CE/UserInterface/Assets/changelog.md index 0d8da9d..a9d2140 100644 --- a/ShinRyuModManager-CE/UserInterface/Assets/changelog.md +++ b/ShinRyuModManager-CE/UserInterface/Assets/changelog.md @@ -1,3 +1,12 @@ +> ### **%{color:orange} Version 1.2.5 %** ### +* Added progress window to mod installation +* Fixed *.7z files not being able to be installed +* Fixed a bug with RebuildMLO +* Fixed a CPK encoding bug +* Fixed a bug with the progress window + +--- + > ### **%{color:orange} Version 1.2.4 %** ### * Upgraded to .NET 10 * General Cleanup diff --git a/ShinRyuModManager-CE/UserInterface/ViewModels/ProgressWindowViewModel.cs b/ShinRyuModManager-CE/UserInterface/ViewModels/ProgressWindowViewModel.cs index 4447c10..99f12fd 100644 --- a/ShinRyuModManager-CE/UserInterface/ViewModels/ProgressWindowViewModel.cs +++ b/ShinRyuModManager-CE/UserInterface/ViewModels/ProgressWindowViewModel.cs @@ -3,12 +3,14 @@ namespace ShinRyuModManager.UserInterface.ViewModels; public partial class ProgressWindowViewModel : ViewModelBase { + [ObservableProperty] private string _title; [ObservableProperty] private string _messageText; [ObservableProperty] private bool _isIndeterminate; public ProgressWindowViewModel() { } - public ProgressWindowViewModel(string messageText, bool isIndeterminate) { + public ProgressWindowViewModel(string title, string messageText, bool isIndeterminate) { + Title = title; MessageText = messageText; IsIndeterminate = isIndeterminate; } diff --git a/ShinRyuModManager-CE/UserInterface/Views/MainWindow.axaml.cs b/ShinRyuModManager-CE/UserInterface/Views/MainWindow.axaml.cs index 40d9239..7401c5a 100644 --- a/ShinRyuModManager-CE/UserInterface/Views/MainWindow.axaml.cs +++ b/ShinRyuModManager-CE/UserInterface/Views/MainWindow.axaml.cs @@ -172,16 +172,20 @@ private async void ModSave_OnClick(object sender, RoutedEventArgs e) { var progressWindow = new ProgressWindow("Applying mods. Please wait...", true); progressWindow.Show(this); + + await Task.Yield(); - try { - await Program.RunGeneration(Program.ConvertNewToOldModList(viewModel.ModList.ToList())); - } catch (Exception ex) { - Log.Error(ex, "Could not generate MLO!"); - - _ = await MessageBoxWindow.Show(this, "Error", "Mods could not be applied. Please make sure that the game directory has write access." + - "\n\nPlease check\"srmm_errors.txt\" for more info."); - } + await Task.Run(async () => { + try { + await Program.RunGeneration(Program.ConvertNewToOldModList(viewModel.ModList.ToList())); + } catch (Exception ex) { + Log.Error(ex, "Could not generate MLO!"); + _ = await MessageBoxWindow.Show(this, "Error", "Mods could not be applied. Please make sure that the game directory has write access." + + "\n\nPlease check\"srmm_errors.txt\" for more info."); + } + }); + progressWindow.Close(); } else { _ = await MessageBoxWindow.Show(this, "Error", "Mod list is empty and was not saved."); @@ -260,18 +264,29 @@ private async void ModInstall_OnClick(object sender, RoutedEventArgs e) { if (files.Count == 0) return; + + var progressWindow = new ProgressWindow("Installing mod(s). Please wait...", true); + + _ = progressWindow.ShowDialog(this); - foreach (var file in files) { - if (!File.Exists(file.TryGetLocalPath())) - return; + await Task.Yield(); - if (!await Utils.TryInstallModZipAsync(file.TryGetLocalPath())) - continue; + await Task.Run(async () => { + foreach (var file in files) { + var localPath = file.TryGetLocalPath(); + + if (!File.Exists(localPath)) + return; - RefreshModList(); - } + await Utils.TryInstallModZipAsync(localPath); + } + + await Program.InstallAllModDependenciesAsync(); + }); + + RefreshModList(); - await Program.InstallAllModDependenciesAsync(); + progressWindow.Close(); } catch (Exception ex) { Log.Fatal(ex, "ModInstalled failed!"); diff --git a/ShinRyuModManager-CE/UserInterface/Views/ProgressWindow.axaml b/ShinRyuModManager-CE/UserInterface/Views/ProgressWindow.axaml index 1d51aaf..22ddc7c 100644 --- a/ShinRyuModManager-CE/UserInterface/Views/ProgressWindow.axaml +++ b/ShinRyuModManager-CE/UserInterface/Views/ProgressWindow.axaml @@ -7,12 +7,14 @@ x:Class="ShinRyuModManager.UserInterface.Views.ProgressWindow" x:DataType="vm:ProgressWindowViewModel" Icon="/UserInterface/Assets/Icons/SRMM_icon.ico" - Title="ProgressWindow" + Title="{Binding Title}" Height="175" Width="400" Background="#FF373535" Foreground="White" - CanResize="False"> + CanResize="False" + CanMinimize="False" + CanMaximize="False">