From 63bd88c5a662df1dbd124f28620836170ed8f2a8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mart=C3=AD=20Climent?= Date: Wed, 18 Dec 2024 23:40:59 +0100 Subject: [PATCH 1/3] Enable trim. Fix flyout menus not working. --- .../SettingsEngine_Dictionaries.cs | 4 +- .../SettingsEngine_Lists.cs | 4 +- src/UniGetUI/Controls/MenuForPackage.cs | 82 +-- src/UniGetUI/UniGetUI.csproj | 576 +++++++++--------- 4 files changed, 333 insertions(+), 333 deletions(-) diff --git a/src/UniGetUI.Core.Settings/SettingsEngine_Dictionaries.cs b/src/UniGetUI.Core.Settings/SettingsEngine_Dictionaries.cs index d190444bc..5c506d59c 100644 --- a/src/UniGetUI.Core.Settings/SettingsEngine_Dictionaries.cs +++ b/src/UniGetUI.Core.Settings/SettingsEngine_Dictionaries.cs @@ -42,7 +42,7 @@ public static partial class Settings { if (result != "") { - Dictionary? item = JsonSerializer.Deserialize>(result); + Dictionary? item = JsonSerializer.Deserialize>(result, CoreData.SerializingOptions); if (item is not null) { value = item; @@ -88,7 +88,7 @@ public static void SetDictionary(string setting, Dictionary value) var file = Path.Join(CoreData.UniGetUIDataDirectory, $"{setting}.json"); try { - if (value.Any()) File.WriteAllText(file, JsonSerializer.Serialize(value)); + if (value.Any()) File.WriteAllText(file, JsonSerializer.Serialize(value, CoreData.SerializingOptions)); else if (File.Exists(file)) File.Delete(file); } catch (Exception e) diff --git a/src/UniGetUI.Core.Settings/SettingsEngine_Lists.cs b/src/UniGetUI.Core.Settings/SettingsEngine_Lists.cs index c5b593268..731384eeb 100644 --- a/src/UniGetUI.Core.Settings/SettingsEngine_Lists.cs +++ b/src/UniGetUI.Core.Settings/SettingsEngine_Lists.cs @@ -39,7 +39,7 @@ public static partial class Settings { if (result != "") { - List? item = JsonSerializer.Deserialize>(result); + List? item = JsonSerializer.Deserialize>(result, CoreData.SerializingOptions); if (item is not null) { value = item; @@ -76,7 +76,7 @@ public static void SetList(string setting, List value) var file = Path.Join(CoreData.UniGetUIDataDirectory, $"{setting}.json"); try { - if (value.Any()) File.WriteAllText(file, JsonSerializer.Serialize(value)); + if (value.Any()) File.WriteAllText(file, JsonSerializer.Serialize(value, CoreData.SerializingOptions)); else if (File.Exists(file)) File.Delete(file); } catch (Exception e) diff --git a/src/UniGetUI/Controls/MenuForPackage.cs b/src/UniGetUI/Controls/MenuForPackage.cs index 983403081..2e9e8719d 100644 --- a/src/UniGetUI/Controls/MenuForPackage.cs +++ b/src/UniGetUI/Controls/MenuForPackage.cs @@ -1,41 +1,41 @@ -using Microsoft.UI.Xaml; -using Microsoft.UI.Xaml.Controls; -using UniGetUI.Core.Tools; -using UniGetUI.Interface.Enums; - -namespace UniGetUI.Interface.Widgets -{ - public class BetterMenu : MenuFlyout - { - private readonly Style menuyStyle = (Style)Application.Current.Resources["BetterContextMenu"]; - public BetterMenu() - { - MenuFlyoutPresenterStyle = menuyStyle; - } - } - - public class BetterMenuItem : MenuFlyoutItem - { - private readonly Style menuStyle = (Style)Application.Current.Resources["BetterMenuItem"]; - - public IconType IconName - { - set - { - var icon = new LocalIcon(value); - icon.FontSize = 24; - Icon = icon; - } - } - - public new string Text - { - set => base.Text = CoreTools.Translate(value); - } - - public BetterMenuItem() - { - Style = menuStyle; - } - } -} +using Microsoft.UI.Xaml; +using Microsoft.UI.Xaml.Controls; +using UniGetUI.Core.Tools; +using UniGetUI.Interface.Enums; + +namespace UniGetUI.Interface.Widgets +{ + public partial class BetterMenu : MenuFlyout + { + private readonly Style menuyStyle = (Style)Application.Current.Resources["BetterContextMenu"]; + public BetterMenu() + { + MenuFlyoutPresenterStyle = menuyStyle; + } + } + + public partial class BetterMenuItem : MenuFlyoutItem + { + private readonly Style menuStyle = (Style)Application.Current.Resources["BetterMenuItem"]; + + public IconType IconName + { + set + { + var icon = new LocalIcon(value); + icon.FontSize = 24; + Icon = icon; + } + } + + public new string Text + { + set => base.Text = CoreTools.Translate(value); + } + + public BetterMenuItem() + { + Style = menuStyle; + } + } +} diff --git a/src/UniGetUI/UniGetUI.csproj b/src/UniGetUI/UniGetUI.csproj index a0917cff4..c809194be 100644 --- a/src/UniGetUI/UniGetUI.csproj +++ b/src/UniGetUI/UniGetUI.csproj @@ -1,288 +1,288 @@ - - - - enable - win-x64;win-arm64 - win-$(Platform) - ARM64;x64 - net8.0-windows10.0.22621.0 - 10.0.19041.0 - Martí Climent and the contributors - Martí Climent - enable - false - Debug;Release - WinExe - UniGetUI - app.manifest - x64 - true - true - UniGetUI.EntryPoint - False - icon.ico - - - true - 8.0.401 - true - true - None - 10.0.26100.56 - - - true - - - - - - - - - - - - Designer - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - $(DefaultXamlRuntime) - Designer - - - $(DefaultXamlRuntime) - Designer - - - $(DefaultXamlRuntime) - - - $(DefaultXamlRuntime) - Designer - - - MSBuild:Compile - - - - - MSBuild:Compile - - - - - MSBuild:Compile - - - - - MSBuild:Compile - - - - - MSBuild:Compile - - - - - true - - - $(DefineConstants);DISABLE_XAML_GENERATED_MAIN - - - $(DefineConstants);DISABLE_XAML_GENERATED_MAIN - - - $(DefineConstants);DISABLE_XAML_GENERATED_MAIN - - - $(DefineConstants);DISABLE_XAML_GENERATED_MAIN - - - - - - - PreserveNewest - - - Always - - - PreserveNewest - - - Always - - - Always - - - Always - - - Always - - - Always - - - - - MSBuild:Compile - - - - - MSBuild:Compile - - - - - MSBuild:Compile - - - - - MSBuild:Compile - - - - - MSBuild:Compile - - - - - MSBuild:Compile - - - - - MSBuild:Compile - - - - - MSBuild:Compile - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Always - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - - - - - - - - - - - - - - - + + + + enable + win-x64;win-arm64 + win-$(Platform) + ARM64;x64 + net8.0-windows10.0.22621.0 + 10.0.19041.0 + Martí Climent and the contributors + Martí Climent + enable + false + Debug;Release + WinExe + UniGetUI + app.manifest + x64 + true + true + UniGetUI.EntryPoint + False + icon.ico + + + true + 8.0.401 + true + true + None + 10.0.26100.56 + + true + partial + true + + + + + + + + + + + + Designer + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + $(DefaultXamlRuntime) + Designer + + + $(DefaultXamlRuntime) + Designer + + + $(DefaultXamlRuntime) + + + $(DefaultXamlRuntime) + Designer + + + MSBuild:Compile + + + + + MSBuild:Compile + + + + + MSBuild:Compile + + + + + MSBuild:Compile + + + + + MSBuild:Compile + + + + + true + + + $(DefineConstants);DISABLE_XAML_GENERATED_MAIN + + + $(DefineConstants);DISABLE_XAML_GENERATED_MAIN + + + $(DefineConstants);DISABLE_XAML_GENERATED_MAIN + + + $(DefineConstants);DISABLE_XAML_GENERATED_MAIN + + + + + + + PreserveNewest + + + Always + + + PreserveNewest + + + Always + + + Always + + + Always + + + Always + + + Always + + + + + MSBuild:Compile + + + + + MSBuild:Compile + + + + + MSBuild:Compile + + + + + MSBuild:Compile + + + + + MSBuild:Compile + + + + + MSBuild:Compile + + + + + MSBuild:Compile + + + + + MSBuild:Compile + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Always + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + + + + + + + + + + + + + + + From 9914e757bbfb706a8d746c033f02e2b9a71dbe41 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mart=C3=AD=20Climent?= Date: Sat, 21 Dec 2024 00:31:14 +0100 Subject: [PATCH 2/3] Mark classes that interact with WinRT as partial --- .../Packages/ImportedPackage.cs | 2 +- .../Packages/InvalidImportedPackage.cs | 2 +- .../Packages/Package.cs | 2 +- src/UniGetUI/Controls/LocalIcon.cs | 4 ++-- src/UniGetUI/Controls/ObservablePackageCollection.cs | 2 +- src/UniGetUI/Controls/OperationWidgets/PackageOperations.cs | 6 +++--- src/UniGetUI/Controls/OperationWidgets/SourceOperations.cs | 4 ++-- src/UniGetUI/Controls/PackageItemContainer.cs | 2 +- src/UniGetUI/Controls/PackageWrapper.cs | 2 +- src/UniGetUI/Controls/SettingsWidgets/ButtonCard.cs | 2 +- src/UniGetUI/Controls/SettingsWidgets/CheckboxButtonCard.cs | 2 +- src/UniGetUI/Controls/SettingsWidgets/CheckboxCard.cs | 2 +- src/UniGetUI/Controls/SettingsWidgets/ComboboxCard.cs | 2 +- src/UniGetUI/Controls/SettingsWidgets/SettingsEntry.cs | 2 +- src/UniGetUI/Controls/SettingsWidgets/TextboxCard.cs | 2 +- src/UniGetUI/Pages/DialogPages/DesktopShortcuts.xaml.cs | 2 +- src/UniGetUI/Pages/LogPages/ManagerLogsPage.cs | 2 +- src/UniGetUI/Pages/LogPages/OperationHistoryPage.cs | 2 +- src/UniGetUI/Pages/LogPages/UniGetUILogPage.cs | 4 ++-- src/UniGetUI/Pages/SoftwarePages/DiscoverSoftwarePage.cs | 2 +- src/UniGetUI/Pages/SoftwarePages/InstalledPackagesPage.cs | 2 +- src/UniGetUI/Pages/SoftwarePages/PackageBundlesPage.cs | 2 +- src/UniGetUI/Pages/SoftwarePages/SoftwareUpdatesPage.cs | 2 +- 23 files changed, 28 insertions(+), 28 deletions(-) diff --git a/src/UniGetUI.PackageEngine.PackageManagerClasses/Packages/ImportedPackage.cs b/src/UniGetUI.PackageEngine.PackageManagerClasses/Packages/ImportedPackage.cs index d93cacdc3..ccc38bf6b 100644 --- a/src/UniGetUI.PackageEngine.PackageManagerClasses/Packages/ImportedPackage.cs +++ b/src/UniGetUI.PackageEngine.PackageManagerClasses/Packages/ImportedPackage.cs @@ -5,7 +5,7 @@ namespace UniGetUI.PackageEngine.PackageClasses { - public class ImportedPackage : Package + public partial class ImportedPackage : Package { /// /// Construct an invalid package with a given name, id, version, source and manager, and an optional scope. diff --git a/src/UniGetUI.PackageEngine.PackageManagerClasses/Packages/InvalidImportedPackage.cs b/src/UniGetUI.PackageEngine.PackageManagerClasses/Packages/InvalidImportedPackage.cs index 4b8982203..dfbad0446 100644 --- a/src/UniGetUI.PackageEngine.PackageManagerClasses/Packages/InvalidImportedPackage.cs +++ b/src/UniGetUI.PackageEngine.PackageManagerClasses/Packages/InvalidImportedPackage.cs @@ -10,7 +10,7 @@ namespace UniGetUI.PackageEngine.PackageClasses { - public class InvalidImportedPackage : IPackage, INotifyPropertyChanged + public partial class InvalidImportedPackage : IPackage, INotifyPropertyChanged { public IPackageDetails Details { get; } diff --git a/src/UniGetUI.PackageEngine.PackageManagerClasses/Packages/Package.cs b/src/UniGetUI.PackageEngine.PackageManagerClasses/Packages/Package.cs index b8fd0f5f7..f70a243ce 100644 --- a/src/UniGetUI.PackageEngine.PackageManagerClasses/Packages/Package.cs +++ b/src/UniGetUI.PackageEngine.PackageManagerClasses/Packages/Package.cs @@ -14,7 +14,7 @@ namespace UniGetUI.PackageEngine.PackageClasses { - public class Package : IPackage + public partial class Package : IPackage { // Internal properties private bool __is_checked; diff --git a/src/UniGetUI/Controls/LocalIcon.cs b/src/UniGetUI/Controls/LocalIcon.cs index 07b471890..f90676c06 100644 --- a/src/UniGetUI/Controls/LocalIcon.cs +++ b/src/UniGetUI/Controls/LocalIcon.cs @@ -5,7 +5,7 @@ namespace UniGetUI.Interface.Widgets { - public class LocalIcon : FontIcon + public partial class LocalIcon : FontIcon { public static FontFamily font = (FontFamily)Application.Current.Resources["SymbolFont"]; @@ -25,7 +25,7 @@ public LocalIcon(IconType icon) : this() } } - public class LocalIconSource : FontIconSource + public partial class LocalIconSource : FontIconSource { public static FontFamily font = (FontFamily)Application.Current.Resources["SymbolFont"]; diff --git a/src/UniGetUI/Controls/ObservablePackageCollection.cs b/src/UniGetUI/Controls/ObservablePackageCollection.cs index b63bf159b..911837db2 100644 --- a/src/UniGetUI/Controls/ObservablePackageCollection.cs +++ b/src/UniGetUI/Controls/ObservablePackageCollection.cs @@ -6,7 +6,7 @@ namespace UniGetUI.PackageEngine.PackageClasses /// /// A special ObservableCollection designed to work with Package objects /// - public class ObservablePackageCollection : SortableObservableCollection + public partial class ObservablePackageCollection : SortableObservableCollection { public enum Sorter { diff --git a/src/UniGetUI/Controls/OperationWidgets/PackageOperations.cs b/src/UniGetUI/Controls/OperationWidgets/PackageOperations.cs index da82de403..4f6fbfce7 100644 --- a/src/UniGetUI/Controls/OperationWidgets/PackageOperations.cs +++ b/src/UniGetUI/Controls/OperationWidgets/PackageOperations.cs @@ -227,7 +227,7 @@ protected override void PostProcessEndAction() } } - public class InstallPackageOperation : PackageOperation + public partial class InstallPackageOperation : PackageOperation { public InstallPackageOperation( @@ -306,7 +306,7 @@ protected override async Task Initialize() } } - public class UpdatePackageOperation : PackageOperation + public partial class UpdatePackageOperation : PackageOperation { public UpdatePackageOperation( @@ -391,7 +391,7 @@ protected override async Task Initialize() } } - public class UninstallPackageOperation : PackageOperation + public partial class UninstallPackageOperation : PackageOperation { public UninstallPackageOperation( diff --git a/src/UniGetUI/Controls/OperationWidgets/SourceOperations.cs b/src/UniGetUI/Controls/OperationWidgets/SourceOperations.cs index 5aea58d79..72d46729d 100644 --- a/src/UniGetUI/Controls/OperationWidgets/SourceOperations.cs +++ b/src/UniGetUI/Controls/OperationWidgets/SourceOperations.cs @@ -116,7 +116,7 @@ protected override void PostProcessEndAction() } } - public class AddSourceOperation : SourceOperation + public partial class AddSourceOperation : SourceOperation { public event EventHandler? OperationSucceeded; @@ -197,7 +197,7 @@ protected override async Task Initialize() } } - public class RemoveSourceOperation : SourceOperation + public partial class RemoveSourceOperation : SourceOperation { public event EventHandler? OperationSucceeded; diff --git a/src/UniGetUI/Controls/PackageItemContainer.cs b/src/UniGetUI/Controls/PackageItemContainer.cs index 3e2d28e26..de8a78ce2 100644 --- a/src/UniGetUI/Controls/PackageItemContainer.cs +++ b/src/UniGetUI/Controls/PackageItemContainer.cs @@ -4,7 +4,7 @@ namespace UniGetUI.Interface.Widgets { - public class PackageItemContainer : ItemContainer + public partial class PackageItemContainer : ItemContainer { public IPackage? Package { get; set; } public PackageWrapper Wrapper { get; set; } = null!; diff --git a/src/UniGetUI/Controls/PackageWrapper.cs b/src/UniGetUI/Controls/PackageWrapper.cs index 4a507ace2..672247e3d 100644 --- a/src/UniGetUI/Controls/PackageWrapper.cs +++ b/src/UniGetUI/Controls/PackageWrapper.cs @@ -13,7 +13,7 @@ namespace UniGetUI.PackageEngine.PackageClasses /// /// A wrapper for packages to be able to show in ItemCollections /// - public class PackageWrapper : IIndexableListItem, INotifyPropertyChanged, IDisposable + public partial class PackageWrapper : IIndexableListItem, INotifyPropertyChanged, IDisposable { private static readonly ConcurrentDictionary CachedPackageIcons = new(); diff --git a/src/UniGetUI/Controls/SettingsWidgets/ButtonCard.cs b/src/UniGetUI/Controls/SettingsWidgets/ButtonCard.cs index d563da324..9c6394214 100644 --- a/src/UniGetUI/Controls/SettingsWidgets/ButtonCard.cs +++ b/src/UniGetUI/Controls/SettingsWidgets/ButtonCard.cs @@ -7,7 +7,7 @@ namespace UniGetUI.Interface.Widgets { - public sealed class ButtonCard : SettingsCard + public sealed partial class ButtonCard : SettingsCard { private readonly Button _button = new(); diff --git a/src/UniGetUI/Controls/SettingsWidgets/CheckboxButtonCard.cs b/src/UniGetUI/Controls/SettingsWidgets/CheckboxButtonCard.cs index 3fee7e56f..62c61936d 100644 --- a/src/UniGetUI/Controls/SettingsWidgets/CheckboxButtonCard.cs +++ b/src/UniGetUI/Controls/SettingsWidgets/CheckboxButtonCard.cs @@ -9,7 +9,7 @@ namespace UniGetUI.Interface.Widgets { - public sealed class CheckboxButtonCard : SettingsCard + public sealed partial class CheckboxButtonCard : SettingsCard { public CheckBox CheckBox; public Button Button; diff --git a/src/UniGetUI/Controls/SettingsWidgets/CheckboxCard.cs b/src/UniGetUI/Controls/SettingsWidgets/CheckboxCard.cs index 9886db087..2416cb780 100644 --- a/src/UniGetUI/Controls/SettingsWidgets/CheckboxCard.cs +++ b/src/UniGetUI/Controls/SettingsWidgets/CheckboxCard.cs @@ -9,7 +9,7 @@ namespace UniGetUI.Interface.Widgets { - public sealed class CheckboxCard : SettingsCard + public sealed partial class CheckboxCard : SettingsCard { public CheckBox _checkbox; private bool IS_INVERTED; diff --git a/src/UniGetUI/Controls/SettingsWidgets/ComboboxCard.cs b/src/UniGetUI/Controls/SettingsWidgets/ComboboxCard.cs index c018f9667..193ae6b7d 100644 --- a/src/UniGetUI/Controls/SettingsWidgets/ComboboxCard.cs +++ b/src/UniGetUI/Controls/SettingsWidgets/ComboboxCard.cs @@ -11,7 +11,7 @@ namespace UniGetUI.Interface.Widgets { - public sealed class ComboboxCard : SettingsCard + public sealed partial class ComboboxCard : SettingsCard { private readonly ComboBox _combobox = new(); private readonly ObservableCollection _elements = new(); diff --git a/src/UniGetUI/Controls/SettingsWidgets/SettingsEntry.cs b/src/UniGetUI/Controls/SettingsWidgets/SettingsEntry.cs index c7a017eba..1aec164c5 100644 --- a/src/UniGetUI/Controls/SettingsWidgets/SettingsEntry.cs +++ b/src/UniGetUI/Controls/SettingsWidgets/SettingsEntry.cs @@ -9,7 +9,7 @@ namespace UniGetUI.Interface.Widgets { - public sealed class SettingsEntry : SettingsExpander + public sealed partial class SettingsEntry : SettingsExpander { private readonly InfoBar infoBar; private readonly Button RestartButton; diff --git a/src/UniGetUI/Controls/SettingsWidgets/TextboxCard.cs b/src/UniGetUI/Controls/SettingsWidgets/TextboxCard.cs index deebbc87f..48e82bc7f 100644 --- a/src/UniGetUI/Controls/SettingsWidgets/TextboxCard.cs +++ b/src/UniGetUI/Controls/SettingsWidgets/TextboxCard.cs @@ -9,7 +9,7 @@ namespace UniGetUI.Interface.Widgets { - public sealed class TextboxCard : SettingsCard + public sealed partial class TextboxCard : SettingsCard { private readonly TextBox _textbox = new(); private readonly HyperlinkButton _helpbutton = new(); diff --git a/src/UniGetUI/Pages/DialogPages/DesktopShortcuts.xaml.cs b/src/UniGetUI/Pages/DialogPages/DesktopShortcuts.xaml.cs index 82aa0a1a1..5114ac8cc 100644 --- a/src/UniGetUI/Pages/DialogPages/DesktopShortcuts.xaml.cs +++ b/src/UniGetUI/Pages/DialogPages/DesktopShortcuts.xaml.cs @@ -101,7 +101,7 @@ public void SaveChangesAndClose() } } - public class ShortcutEntry : INotifyPropertyChanged + public partial class ShortcutEntry : INotifyPropertyChanged { public event EventHandler? OnReset; diff --git a/src/UniGetUI/Pages/LogPages/ManagerLogsPage.cs b/src/UniGetUI/Pages/LogPages/ManagerLogsPage.cs index eed0d119f..fe33d51e0 100644 --- a/src/UniGetUI/Pages/LogPages/ManagerLogsPage.cs +++ b/src/UniGetUI/Pages/LogPages/ManagerLogsPage.cs @@ -7,7 +7,7 @@ namespace UniGetUI.Interface.Pages.LogPage { - public class ManagerLogsPage : BaseLogPage + public partial class ManagerLogsPage : BaseLogPage { public ManagerLogsPage() : base(true) diff --git a/src/UniGetUI/Pages/LogPages/OperationHistoryPage.cs b/src/UniGetUI/Pages/LogPages/OperationHistoryPage.cs index a05775dd9..5de61ad23 100644 --- a/src/UniGetUI/Pages/LogPages/OperationHistoryPage.cs +++ b/src/UniGetUI/Pages/LogPages/OperationHistoryPage.cs @@ -3,7 +3,7 @@ namespace UniGetUI.Interface.Pages.LogPage { - public class OperationHistoryPage : BaseLogPage + public partial class OperationHistoryPage : BaseLogPage { public OperationHistoryPage() : base(false) { diff --git a/src/UniGetUI/Pages/LogPages/UniGetUILogPage.cs b/src/UniGetUI/Pages/LogPages/UniGetUILogPage.cs index 84a2a5f11..19b62d1ce 100644 --- a/src/UniGetUI/Pages/LogPages/UniGetUILogPage.cs +++ b/src/UniGetUI/Pages/LogPages/UniGetUILogPage.cs @@ -1,11 +1,11 @@ -using Microsoft.UI.Xaml.Documents; +using Microsoft.UI.Xaml.Documents; using Microsoft.UI.Xaml.Media; using UniGetUI.Core.Logging; using UniGetUI.Core.Tools; namespace UniGetUI.Interface.Pages.LogPage { - public sealed class UniGetUILogPage : BaseLogPage + public sealed partial class UniGetUILogPage : BaseLogPage { public UniGetUILogPage() : base(true) { diff --git a/src/UniGetUI/Pages/SoftwarePages/DiscoverSoftwarePage.cs b/src/UniGetUI/Pages/SoftwarePages/DiscoverSoftwarePage.cs index 8bb16099c..bfb3e4bfd 100644 --- a/src/UniGetUI/Pages/SoftwarePages/DiscoverSoftwarePage.cs +++ b/src/UniGetUI/Pages/SoftwarePages/DiscoverSoftwarePage.cs @@ -15,7 +15,7 @@ namespace UniGetUI.Interface.SoftwarePages { - public class DiscoverSoftwarePage : AbstractPackagesPage + public partial class DiscoverSoftwarePage : AbstractPackagesPage { private BetterMenuItem? MenuAsAdmin; private BetterMenuItem? MenuInteractive; diff --git a/src/UniGetUI/Pages/SoftwarePages/InstalledPackagesPage.cs b/src/UniGetUI/Pages/SoftwarePages/InstalledPackagesPage.cs index 0dc3b182a..e405966a1 100644 --- a/src/UniGetUI/Pages/SoftwarePages/InstalledPackagesPage.cs +++ b/src/UniGetUI/Pages/SoftwarePages/InstalledPackagesPage.cs @@ -16,7 +16,7 @@ namespace UniGetUI.Interface.SoftwarePages { - public class InstalledPackagesPage : AbstractPackagesPage + public partial class InstalledPackagesPage : AbstractPackagesPage { private bool HasDoneBackup; diff --git a/src/UniGetUI/Pages/SoftwarePages/PackageBundlesPage.cs b/src/UniGetUI/Pages/SoftwarePages/PackageBundlesPage.cs index db08e821d..d8c80a231 100644 --- a/src/UniGetUI/Pages/SoftwarePages/PackageBundlesPage.cs +++ b/src/UniGetUI/Pages/SoftwarePages/PackageBundlesPage.cs @@ -21,7 +21,7 @@ namespace UniGetUI.Interface.SoftwarePages { - public class PackageBundlesPage : AbstractPackagesPage + public partial class PackageBundlesPage : AbstractPackagesPage { private BetterMenuItem? MenuInstallOptions; private BetterMenuItem? MenuInstall; diff --git a/src/UniGetUI/Pages/SoftwarePages/SoftwareUpdatesPage.cs b/src/UniGetUI/Pages/SoftwarePages/SoftwareUpdatesPage.cs index 1570c8615..e44d05bc8 100644 --- a/src/UniGetUI/Pages/SoftwarePages/SoftwareUpdatesPage.cs +++ b/src/UniGetUI/Pages/SoftwarePages/SoftwareUpdatesPage.cs @@ -17,7 +17,7 @@ namespace UniGetUI.Interface.SoftwarePages { - public class SoftwareUpdatesPage : AbstractPackagesPage + public partial class SoftwareUpdatesPage : AbstractPackagesPage { private BetterMenuItem? MenuAsAdmin; private BetterMenuItem? MenuInteractive; From 48ccc2d2dae60ffb021d486bbd6eba4a45d76f67 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mart=C3=AD=20Climent?= Date: Sat, 21 Dec 2024 16:15:04 +0100 Subject: [PATCH 3/3] Fix tests not passing --- src/UniGetUI.Core.Settings.Tests/SettingsTest.cs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/UniGetUI.Core.Settings.Tests/SettingsTest.cs b/src/UniGetUI.Core.Settings.Tests/SettingsTest.cs index d99c67c9c..ab82de8dd 100644 --- a/src/UniGetUI.Core.Settings.Tests/SettingsTest.cs +++ b/src/UniGetUI.Core.Settings.Tests/SettingsTest.cs @@ -114,7 +114,7 @@ public void TestListSettings(string SettingName, string[] ls1Array, int[] ls2Arr Assert.Equal("this is now a test case", Settings.GetListItem(SettingName, 3)); Assert.Null(Settings.GetListItem(SettingName, 4)); - Assert.Equal(Settings.GetListItem(SettingName, 0), JsonSerializer.Deserialize>(File.ReadAllText(Path.Join(CoreData.UniGetUIDataDirectory, $"{SettingName}.json")))[0]); + Assert.Equal(Settings.GetListItem(SettingName, 0), JsonSerializer.Deserialize>(File.ReadAllText(Path.Join(CoreData.UniGetUIDataDirectory, $"{SettingName}.json")), CoreData.SerializingOptions)[0]); Settings.ClearList(SettingName); Assert.Empty(Settings.GetList(SettingName) ?? ["this shouldn't be null; something's wrong"]); @@ -168,7 +168,7 @@ public void TestDictionarySettings(string SettingName, string[] keyArray, int[] Settings.SetDictionaryItem(randStr, "key", 12); Assert.Equal(12, Settings.GetDictionaryItem(randStr, "key")); Settings.SetDictionary(SettingName, test); - Assert.Equal(JsonSerializer.Serialize(test), File.ReadAllLines(Path.Join(CoreData.UniGetUIDataDirectory, $"{SettingName}.json"))[0]); + Assert.Equal(JsonSerializer.Serialize(test, CoreData.SerializingOptions), File.ReadAllText(Path.Join(CoreData.UniGetUIDataDirectory, $"{SettingName}.json"))); Assert.Equal(test[keyArray[0]]?.sub.count, Settings.GetDictionary(SettingName)?[keyArray[0]]?.sub.count); Assert.Equal(test[keyArray[1]]?.sub.count, Settings.GetDictionaryItem(SettingName, keyArray[1])?.sub.count); Settings.SetDictionaryItem(SettingName, keyArray[0], test[keyArray[1]]); @@ -199,8 +199,8 @@ public void TestDictionarySettings(string SettingName, string[] keyArray, int[] Assert.True(Settings.DictionaryContainsValue(SettingName, test[keyArray[2]])); Assert.Equal( - JsonSerializer.Serialize(Settings.GetDictionary(SettingName)), - File.ReadAllLines(Path.Join(CoreData.UniGetUIDataDirectory, $"{SettingName}.json"))[0] + JsonSerializer.Serialize(Settings.GetDictionary(SettingName), CoreData.SerializingOptions), + File.ReadAllText(Path.Join(CoreData.UniGetUIDataDirectory, $"{SettingName}.json")) ); Settings.ClearDictionary(SettingName); // Cleanup