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 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.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 5d212a637..0180cdabd 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/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/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 b263de141..5b592cbe3 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; diff --git a/src/UniGetUI/UniGetUI.csproj b/src/UniGetUI/UniGetUI.csproj index 7708e593f..d19e57c9e 100644 --- a/src/UniGetUI/UniGetUI.csproj +++ b/src/UniGetUI/UniGetUI.csproj @@ -30,8 +30,8 @@ None - false - + true + partial true