From 731fbc56f73b5a82b1af8c1834845e486866333a Mon Sep 17 00:00:00 2001 From: Benjamin Date: Fri, 1 May 2026 10:19:42 -0600 Subject: [PATCH 1/5] Package upgrades - Migrated to Avalonia 12 - Bumped all packages - Full migration on hold until Netsparkle updates Avalonia --- CpkTools/CpkTools.csproj | 2 +- ParLibrary.Tests/ParLibrary.Tests.csproj | 8 +-- ParLibrary/Converter/ParArchiveReader.cs | 8 +-- ParLibrary/Converter/ParArchiveWriter.cs | 11 ++-- ParLibrary/ParLibrary.csproj | 2 +- .../ModLoadOrder/Generator.cs | 2 - .../ModLoadOrder/Mods/ModInfo.cs | 6 +- ShinRyuModManager-CE/Program.cs | 2 +- .../ShinRyuModManager-CE.csproj | 30 +++++----- .../UserInterface/App.axaml.cs | 22 ++----- .../ViewModels/AboutWindowViewModel.cs | 7 ++- .../ViewModels/ChangeLogWindowViewModel.cs | 3 +- .../LibraryDisplayControlViewModel.cs | 58 +++++++++++++------ .../ViewModels/LibraryManagerViewModel.cs | 3 +- .../ViewModels/MainWindowViewModel.cs | 30 +++++++--- .../ViewModels/MessageBoxWindowViewModel.cs | 7 ++- .../ViewModels/ProgressWindowViewModel.cs | 11 +++- .../UserInterface/Views/MainWindow.axaml | 4 +- ShinRyuModManager-CE/Utils.cs | 18 +++--- 19 files changed, 135 insertions(+), 99 deletions(-) diff --git a/CpkTools/CpkTools.csproj b/CpkTools/CpkTools.csproj index 0af915f..2e3a97a 100644 --- a/CpkTools/CpkTools.csproj +++ b/CpkTools/CpkTools.csproj @@ -7,7 +7,7 @@ - + diff --git a/ParLibrary.Tests/ParLibrary.Tests.csproj b/ParLibrary.Tests/ParLibrary.Tests.csproj index 0013197..71e80b9 100644 --- a/ParLibrary.Tests/ParLibrary.Tests.csproj +++ b/ParLibrary.Tests/ParLibrary.Tests.csproj @@ -12,10 +12,10 @@ - - - - + + + + all runtime; build; native; contentfiles; analyzers; buildtransitive diff --git a/ParLibrary/Converter/ParArchiveReader.cs b/ParLibrary/Converter/ParArchiveReader.cs index 126c3e8..808e8a3 100644 --- a/ParLibrary/Converter/ParArchiveReader.cs +++ b/ParLibrary/Converter/ParArchiveReader.cs @@ -166,8 +166,8 @@ public NodeContainerFormat Convert(BinaryFormat source) { } private static void BuildTree(Node node, IReadOnlyList folders, IReadOnlyList files, ParArchiveReaderParameters parameters) { - int firstFolderIndex = node.Tags["FirstFolderIndex"]; - int folderCount = node.Tags["FolderCount"]; + var firstFolderIndex = (int)node.Tags["FirstFolderIndex"]; + var folderCount = (int)node.Tags["FolderCount"]; for (var i = firstFolderIndex; i < firstFolderIndex + folderCount; i++) { node.Add(folders[i]); @@ -175,8 +175,8 @@ private static void BuildTree(Node node, IReadOnlyList folders, IReadOnlyL BuildTree(folders[i], folders, files, parameters); } - int firstFileIndex = node.Tags["FirstFileIndex"]; - int fileCount = node.Tags["FileCount"]; + var firstFileIndex = (int)node.Tags["FirstFileIndex"]; + var fileCount = (int)node.Tags["FileCount"]; for (var i = firstFileIndex; i < firstFileIndex + fileCount; i++) { if (parameters.Recursive && diff --git a/ParLibrary/Converter/ParArchiveWriter.cs b/ParLibrary/Converter/ParArchiveWriter.cs index 18b2540..e8a58c3 100644 --- a/ParLibrary/Converter/ParArchiveWriter.cs +++ b/ParLibrary/Converter/ParArchiveWriter.cs @@ -183,11 +183,12 @@ private static void GetFoldersAndFiles(Node root, List folders, List files.Add(child); fileIndex++; - folder.Tags["FileCount"]++; + + folder.Tags["FileCount"] = (int)folder.Tags["FileCount"] + 1; } else { folders.Add(child); folderIndex++; - folder.Tags["FolderCount"]++; + folder.Tags["FolderCount"] = (int)folder.Tags["FolderCount"] + 1; queue.Enqueue(child); } @@ -198,7 +199,7 @@ private static void GetFoldersAndFiles(Node root, List folders, List files.Add(child); fileIndex++; - folder.Tags["FileCount"]++; + folder.Tags["FileCount"] = (int)folder.Tags["FileCount"] + 1; } } } @@ -252,7 +253,7 @@ private static void WriteFolders(DataWriter writer, IEnumerable folders) { var attributes = 0x00000010; if (tags.TryGetValue("DirectoryInfo", out var directoryInfo)) { - DirectoryInfo info = directoryInfo; + var info = (DirectoryInfo)directoryInfo; attributes = (int)info.Attributes; } @@ -297,7 +298,7 @@ private static void WriteFiles(DataWriter writer, IEnumerable files, long var baseDate = DateTime.UnixEpoch; if (node.Tags.TryGetValue("Timestamp", out var timestamp)) { - date = baseDate.AddSeconds(timestamp); + date = baseDate.AddSeconds((double)timestamp); } if (node.Tags.TryGetValue("FileInfo", out var fileInfo) && fileInfo is FileInfo info) { diff --git a/ParLibrary/ParLibrary.csproj b/ParLibrary/ParLibrary.csproj index c51de85..eee2911 100644 --- a/ParLibrary/ParLibrary.csproj +++ b/ParLibrary/ParLibrary.csproj @@ -9,7 +9,7 @@ - + diff --git a/ShinRyuModManager-CE/ModLoadOrder/Generator.cs b/ShinRyuModManager-CE/ModLoadOrder/Generator.cs index 002799f..da28afa 100644 --- a/ShinRyuModManager-CE/ModLoadOrder/Generator.cs +++ b/ShinRyuModManager-CE/ModLoadOrder/Generator.cs @@ -37,8 +37,6 @@ public static async Task GenerateModeLoadOrder(List mods, bool loo Log.Information("Reading mods...\n"); - // TODO: Make mod reading async - // Use a reverse loop to be able to remove items from the list when necessary for (var i = mods.Count - 1; i >= 0; i--) { var mod = new Mod(mods[i]); diff --git a/ShinRyuModManager-CE/ModLoadOrder/Mods/ModInfo.cs b/ShinRyuModManager-CE/ModLoadOrder/Mods/ModInfo.cs index 07ae7e6..dd5d318 100644 --- a/ShinRyuModManager-CE/ModLoadOrder/Mods/ModInfo.cs +++ b/ShinRyuModManager-CE/ModLoadOrder/Mods/ModInfo.cs @@ -4,8 +4,9 @@ namespace ShinRyuModManager.ModLoadOrder.Mods; public sealed partial class ModInfo : ObservableObject, IEquatable { - [ObservableProperty] private string _name; - + [ObservableProperty] + public partial string Name { get; set; } + public ProfileMask EnabledProfiles { get; set; } public bool Enabled { @@ -16,6 +17,7 @@ public bool Enabled { } else { EnabledProfiles &= ~Program.ActiveProfile.ToMask(); } + OnPropertyChanged(); } } diff --git a/ShinRyuModManager-CE/Program.cs b/ShinRyuModManager-CE/Program.cs index 6cd194a..b5cac3f 100644 --- a/ShinRyuModManager-CE/Program.cs +++ b/ShinRyuModManager-CE/Program.cs @@ -71,7 +71,7 @@ private static void Main(string[] args) { .WriteTo.Async(a => a.File(new JsonFormatter(renderMessage: true), errorLogsPath, rollingInterval: RollingInterval.Day))) .CreateLogger(); -#if LINUX_SLIM +#if LINUX_SLIM || DEBUG // Slim versions of Linux need to have .NET 10 installed to run and Proton/Wine makes that // annoying to find to get this working. Temporarily disabled. RebuildMlo = false; diff --git a/ShinRyuModManager-CE/ShinRyuModManager-CE.csproj b/ShinRyuModManager-CE/ShinRyuModManager-CE.csproj index 81899c4..e9bb228 100644 --- a/ShinRyuModManager-CE/ShinRyuModManager-CE.csproj +++ b/ShinRyuModManager-CE/ShinRyuModManager-CE.csproj @@ -44,28 +44,28 @@ - - - - - - - - + + + + + + + + - + - - + + - - - - + + + + diff --git a/ShinRyuModManager-CE/UserInterface/App.axaml.cs b/ShinRyuModManager-CE/UserInterface/App.axaml.cs index 87fde7e..fb67a60 100644 --- a/ShinRyuModManager-CE/UserInterface/App.axaml.cs +++ b/ShinRyuModManager-CE/UserInterface/App.axaml.cs @@ -1,8 +1,6 @@ -using System.Diagnostics.CodeAnalysis; using System.Globalization; using Avalonia; using Avalonia.Controls.ApplicationLifetimes; -using Avalonia.Data.Core.Plugins; using Avalonia.Markup.Xaml; using Serilog; using ShinRyuModManager.UserInterface.ViewModels; @@ -17,10 +15,6 @@ public override void Initialize() { public override void OnFrameworkInitializationCompleted() { if (ApplicationLifetime is IClassicDesktopStyleApplicationLifetime desktop) { - // Avoid duplicate validations from both Avalonia and the CommunityToolkit. - // More info: https://docs.avaloniaui.net/docs/guides/development-guides/data-validation#manage-validationplugins - DisableAvaloniaDataAnnotationValidation(); - var culture = new CultureInfo("en"); CultureInfo.DefaultThreadCurrentCulture = culture; @@ -34,6 +28,10 @@ public override void OnFrameworkInitializationCompleted() { desktop.Exit += DesktopOnExit; } + +#if DEBUG + this.AttachDeveloperTools(); +#endif base.OnFrameworkInitializationCompleted(); } @@ -42,17 +40,5 @@ public override void OnFrameworkInitializationCompleted() { private static void DesktopOnExit(object sender, ControlledApplicationLifetimeExitEventArgs e) { Log.CloseAndFlush(); } - - [UnconditionalSuppressMessage("Trimming", "IL2026", Justification = "Only removing validation plugins; no reflection or property access used.")] - private static void DisableAvaloniaDataAnnotationValidation() { - // Get an array of plugins to remove - var dataValidationPluginsToRemove = - BindingPlugins.DataValidators.OfType().ToArray(); - - // remove each entry found - foreach (var plugin in dataValidationPluginsToRemove) { - BindingPlugins.DataValidators.Remove(plugin); - } - } } diff --git a/ShinRyuModManager-CE/UserInterface/ViewModels/AboutWindowViewModel.cs b/ShinRyuModManager-CE/UserInterface/ViewModels/AboutWindowViewModel.cs index f8c81a0..3c6246c 100644 --- a/ShinRyuModManager-CE/UserInterface/ViewModels/AboutWindowViewModel.cs +++ b/ShinRyuModManager-CE/UserInterface/ViewModels/AboutWindowViewModel.cs @@ -4,8 +4,11 @@ namespace ShinRyuModManager.UserInterface.ViewModels; public partial class AboutWindowViewModel : ViewModelBase { - [ObservableProperty] private string _version; - [ObservableProperty] private string _creditsText; + [ObservableProperty] + public partial string Version { get; set; } + + [ObservableProperty] + public partial string CreditsText { get; set; } public AboutWindowViewModel() { Initialize(); diff --git a/ShinRyuModManager-CE/UserInterface/ViewModels/ChangeLogWindowViewModel.cs b/ShinRyuModManager-CE/UserInterface/ViewModels/ChangeLogWindowViewModel.cs index 821bcf7..0ffca83 100644 --- a/ShinRyuModManager-CE/UserInterface/ViewModels/ChangeLogWindowViewModel.cs +++ b/ShinRyuModManager-CE/UserInterface/ViewModels/ChangeLogWindowViewModel.cs @@ -3,7 +3,8 @@ namespace ShinRyuModManager.UserInterface.ViewModels; public partial class ChangeLogWindowViewModel : ViewModelBase { - [ObservableProperty] private string _changeLogText; + [ObservableProperty] + public partial string ChangeLogText { get; set; } public ChangeLogWindowViewModel() { Initialize(); diff --git a/ShinRyuModManager-CE/UserInterface/ViewModels/LibraryDisplayControlViewModel.cs b/ShinRyuModManager-CE/UserInterface/ViewModels/LibraryDisplayControlViewModel.cs index c1778a1..5810398 100644 --- a/ShinRyuModManager-CE/UserInterface/ViewModels/LibraryDisplayControlViewModel.cs +++ b/ShinRyuModManager-CE/UserInterface/ViewModels/LibraryDisplayControlViewModel.cs @@ -3,27 +3,49 @@ namespace ShinRyuModManager.UserInterface.ViewModels; public partial class LibraryDisplayControlViewModel : ViewModelBase { - [ObservableProperty] private string _libName = "Name"; - [ObservableProperty] private string _author = "Author"; - [ObservableProperty] private string _description = "Description"; - [ObservableProperty] private string _guid = "Guid"; - [ObservableProperty] private string _version = "Version"; - [ObservableProperty] private string _sourceLink; - - [ObservableProperty] private bool _enableBtnVisibility; - [ObservableProperty] private bool _disableBtnVisibility; - [ObservableProperty] private bool _installBtnVisibility; - [ObservableProperty] private bool _uninstallBtnVisibility; - [ObservableProperty] private bool _updateBtnVisibility; - [ObservableProperty] private bool _sourceBtnVisibility; + [ObservableProperty] + public partial string LibName { get; set; } = "Name"; + + [ObservableProperty] + public partial string Author { get; set; } = "Author"; + + [ObservableProperty] + public partial string Description { get; set; } = "Description"; + + [ObservableProperty] + public partial string Guid { get; set; } = "Guid"; + + [ObservableProperty] + public partial string Version { get; set; } = "Version"; + + [ObservableProperty] + public partial string SourceLink { get; set; } + + [ObservableProperty] + public partial bool EnableBtnVisibility { get; set; } + + [ObservableProperty] + public partial bool DisableBtnVisibility { get; set; } + + [ObservableProperty] + public partial bool InstallBtnVisibility { get; set; } + + [ObservableProperty] + public partial bool UninstallBtnVisibility { get; set; } + + [ObservableProperty] + public partial bool UpdateBtnVisibility { get; set; } + + [ObservableProperty] + public partial bool SourceBtnVisibility { get; set; } public LibraryDisplayControlViewModel() { } public LibraryDisplayControlViewModel(LibMeta meta) { - _libName = meta.Name; - _author = meta.Author; - _description = meta.Description; - _guid = meta.GUID.ToString(); - _version = meta.Version; + LibName = meta.Name; + Author = meta.Author; + Description = meta.Description; + Guid = meta.GUID.ToString(); + Version = meta.Version; } } diff --git a/ShinRyuModManager-CE/UserInterface/ViewModels/LibraryManagerViewModel.cs b/ShinRyuModManager-CE/UserInterface/ViewModels/LibraryManagerViewModel.cs index a25c758..a647e0c 100644 --- a/ShinRyuModManager-CE/UserInterface/ViewModels/LibraryManagerViewModel.cs +++ b/ShinRyuModManager-CE/UserInterface/ViewModels/LibraryManagerViewModel.cs @@ -5,5 +5,6 @@ namespace ShinRyuModManager.UserInterface.ViewModels; public partial class LibraryManagerViewModel : ViewModelBase { - [ObservableProperty] private ObservableCollection _library = []; + [ObservableProperty] + public partial ObservableCollection Library { get; set; } = []; } diff --git a/ShinRyuModManager-CE/UserInterface/ViewModels/MainWindowViewModel.cs b/ShinRyuModManager-CE/UserInterface/ViewModels/MainWindowViewModel.cs index 6c49fe4..73a0316 100644 --- a/ShinRyuModManager-CE/UserInterface/ViewModels/MainWindowViewModel.cs +++ b/ShinRyuModManager-CE/UserInterface/ViewModels/MainWindowViewModel.cs @@ -10,15 +10,29 @@ namespace ShinRyuModManager.UserInterface.ViewModels; public partial class MainWindowViewModel : ViewModelBase { - [ObservableProperty] private string _titleText = "Shin Ryu Mod Manager"; - [ObservableProperty] private string _appVersionText = "SRMM Version"; - [ObservableProperty] private string _gameLaunchPath; + [ObservableProperty] + public partial string TitleText { get; set; } = "Shin Ryu Mod Manager"; + + [ObservableProperty] + public partial string AppVersionText { get; set; } = "SRMM Version"; + + [ObservableProperty] + public partial string GameLaunchPath { get; set; } + + [ObservableProperty] + public partial string ModName { get; set; } = "Mod Name"; - [ObservableProperty] private string _modName = "Mod Name"; - [ObservableProperty] private string _modDescription = "Mod Description"; - [ObservableProperty] private string _modAuthor = "Author"; - [ObservableProperty] private string _modVersion = "Version"; - [ObservableProperty] private ObservableCollection _modList; + [ObservableProperty] + public partial string ModDescription { get; set; } = "Mod Description"; + + [ObservableProperty] + public partial string ModAuthor { get; set; } = "Author"; + + [ObservableProperty] + public partial string ModVersion { get; set; } = "Version"; + + [ObservableProperty] + public partial ObservableCollection ModList { get; set; } public MainWindowViewModel() { Initialize(); diff --git a/ShinRyuModManager-CE/UserInterface/ViewModels/MessageBoxWindowViewModel.cs b/ShinRyuModManager-CE/UserInterface/ViewModels/MessageBoxWindowViewModel.cs index cdc833a..37fc25e 100644 --- a/ShinRyuModManager-CE/UserInterface/ViewModels/MessageBoxWindowViewModel.cs +++ b/ShinRyuModManager-CE/UserInterface/ViewModels/MessageBoxWindowViewModel.cs @@ -3,8 +3,11 @@ namespace ShinRyuModManager.UserInterface.ViewModels; public partial class MessageBoxWindowViewModel : ViewModelBase { - [ObservableProperty] private bool _showCancel; - [ObservableProperty] private bool _showDontRemind; + [ObservableProperty] + public partial bool ShowCancel { get; set; } + + [ObservableProperty] + public partial bool ShowDontRemind { get; set; } public MessageBoxWindowViewModel() { ShowCancel = true; diff --git a/ShinRyuModManager-CE/UserInterface/ViewModels/ProgressWindowViewModel.cs b/ShinRyuModManager-CE/UserInterface/ViewModels/ProgressWindowViewModel.cs index 99f12fd..69cdaf6 100644 --- a/ShinRyuModManager-CE/UserInterface/ViewModels/ProgressWindowViewModel.cs +++ b/ShinRyuModManager-CE/UserInterface/ViewModels/ProgressWindowViewModel.cs @@ -3,9 +3,14 @@ namespace ShinRyuModManager.UserInterface.ViewModels; public partial class ProgressWindowViewModel : ViewModelBase { - [ObservableProperty] private string _title; - [ObservableProperty] private string _messageText; - [ObservableProperty] private bool _isIndeterminate; + [ObservableProperty] + public partial string Title { get; set; } + + [ObservableProperty] + public partial string MessageText { get; set; } + + [ObservableProperty] + public partial bool IsIndeterminate { get; set; } public ProgressWindowViewModel() { } diff --git a/ShinRyuModManager-CE/UserInterface/Views/MainWindow.axaml b/ShinRyuModManager-CE/UserInterface/Views/MainWindow.axaml index 3c7cfb2..7f2e801 100644 --- a/ShinRyuModManager-CE/UserInterface/Views/MainWindow.axaml +++ b/ShinRyuModManager-CE/UserInterface/Views/MainWindow.axaml @@ -45,7 +45,7 @@