From 04848d46226d8e0c22acbc7972ebeaf00998595c Mon Sep 17 00:00:00 2001 From: Pilzinsel64 Date: Thu, 26 Jun 2025 18:53:00 +0200 Subject: [PATCH] repair manager project --- .../AppSymbolFactory.cs | 6 +-- ModpackUpdater.Apps.Client/MainWindow.cs | 31 ++++++++------- .../ModpackUpdater.Apps.Client.csproj | 2 +- ModpackUpdater.Apps.Client/Program.cs | 23 ++++++++++- .../Api/Model/IMainApi.cs | 2 +- .../Api/Plugins/Features/WorkspaceFeature.cs | 2 +- .../AppSymbolFactory.cs | 17 +++++++++ .../CM/CheckSingleActionHealthyFeature.cs | 2 +- .../Features/CM/ClearDirectLinkFeature.cs | 2 +- .../Features/CM/UpdateCollectorFeature.cs | 2 +- .../Features/CM/UpdateDirectLinkFeature.cs | 2 +- .../Features/SharedFunctions.cs | 8 ++-- .../Tools/CheckAllActionsHealthyFeature.cs | 2 +- .../Features/Tools/ClearDirectLinksFeature.cs | 2 +- .../Tools/GenerateChangelogFeature.cs | 2 +- .../Tools/GenerateModlistAsExcelFeature.cs | 2 +- .../Tools/GenerateModlistAsMarkdownFeature.cs | 2 +- .../Tools/UpdateDirectLinksFeature.cs | 2 +- .../Features/Tools/UpdatesCollectorFeature.cs | 2 +- .../GitLabRepo/GitLabRepoWorkspace.cs | 1 - .../GitLabRepoWorkspaceConfigEditor.cs | 2 +- .../GitLabRepo/GitLabRepoWorkspaceFeature.cs | 8 ++-- .../ModpackUpdater.Apps.Manager.csproj | 22 ++++++----- ModpackUpdater.Apps.Manager/Program.cs | 17 ++++++++- ModpackUpdater.Apps.Manager/Ui/MainForm.cs | 38 +++++++++---------- .../Ui/UpdatePropertiesEditorFlyout.cs | 2 +- ModpackUpdater.Apps/AppGlobals.cs | 34 ----------------- .../ModpackUpdater.Apps.csproj | 2 +- ModpackUpdater.Manager/Extensions.cs | 2 +- ModpackUpdater.Manager/ModpackInstaller.cs | 2 +- ModpackUpdater/InstallOption.cs | 8 +--- 31 files changed, 129 insertions(+), 122 deletions(-) rename {ModpackUpdater.Apps => ModpackUpdater.Apps.Client}/AppSymbolFactory.cs (63%) create mode 100644 ModpackUpdater.Apps.Manager/AppSymbolFactory.cs delete mode 100644 ModpackUpdater.Apps/AppGlobals.cs diff --git a/ModpackUpdater.Apps/AppSymbolFactory.cs b/ModpackUpdater.Apps.Client/AppSymbolFactory.cs similarity index 63% rename from ModpackUpdater.Apps/AppSymbolFactory.cs rename to ModpackUpdater.Apps.Client/AppSymbolFactory.cs index b599d16..7f83f14 100644 --- a/ModpackUpdater.Apps/AppSymbolFactory.cs +++ b/ModpackUpdater.Apps.Client/AppSymbolFactory.cs @@ -1,17 +1,17 @@ using Pilz.UI.Gtk.Symbols; using System.Reflection; -namespace ModpackUpdater.Apps; +namespace ModpackUpdater.Apps.Client; internal class AppSymbolFactory : GtkSymbolFactory { public override Assembly GetImageResourceAssembly() { - return Assembly.GetExecutingAssembly(); + return typeof(AppSymbols).Assembly; } public override string GetImageRessourcePath(AppSymbols svgImage) { - return $"{GetType().Namespace}.Symbols.{svgImage}.svg"; + return $"{typeof(AppSymbols).Namespace}.Symbols.{svgImage}.svg"; } } diff --git a/ModpackUpdater.Apps.Client/MainWindow.cs b/ModpackUpdater.Apps.Client/MainWindow.cs index bf58816..5d7066b 100644 --- a/ModpackUpdater.Apps.Client/MainWindow.cs +++ b/ModpackUpdater.Apps.Client/MainWindow.cs @@ -6,7 +6,6 @@ using Pilz.UI.Gtk.Dialogs; using Pilz.UI.Symbols; using System.Diagnostics; using System.Reflection; -using System.Security.Cryptography; using UI = Gtk.Builder.ObjectAttribute; namespace ModpackUpdater.Apps.Client; @@ -45,10 +44,10 @@ internal class MainWindow : Window Title = $"{Title} (v{Assembly.GetExecutingAssembly().GetAppVersion()})"; - button_CheckForUpdates.Image = AppGlobals.Symbols.GetImage(AppSymbols.update_done, SymbolSize.Small); - button_SearchMinecraftFolder.Image = AppGlobals.Symbols.GetImage(AppSymbols.opened_folder, SymbolSize.Small); - button_Install.Image = AppGlobals.Symbols.GetImage(AppSymbols.software_installer, SymbolSize.Small); - image_Repair.Pixbuf = AppGlobals.Symbols.GetPixbuf(AppSymbols.wrench, SymbolSize.Small); + button_CheckForUpdates.Image = Program.Symbols.GetImage(AppSymbols.update_done, SymbolSize.Small); + button_SearchMinecraftFolder.Image = Program.Symbols.GetImage(AppSymbols.opened_folder, SymbolSize.Small); + button_Install.Image = Program.Symbols.GetImage(AppSymbols.software_installer, SymbolSize.Small); + image_Repair.Pixbuf = Program.Symbols.GetPixbuf(AppSymbols.wrench, SymbolSize.Small); LoadProfileToUi(); @@ -77,7 +76,7 @@ internal class MainWindow : Window var updater = new AppUpdater(); if (!updateOptions.NoUpdate && await updater.Check() && MessageBox.Show(this, ButtonsType.YesNo, MessageType.Info, LangRes.MsgBox_UpdateAvailable) == ResponseType.Yes) { - SetStatus(LangRes.StatusText_InstallingAppUpdate, AppGlobals.Symbols.GetPixbuf(AppSymbols.software_installer, SymbolSize.Small)); + SetStatus(LangRes.StatusText_InstallingAppUpdate, Program.Symbols.GetPixbuf(AppSymbols.software_installer, SymbolSize.Small)); Sensitive = false; await updater.Install(); Program.Restart(); @@ -203,21 +202,21 @@ internal class MainWindow : Window if (modpackInfo == null || string.IsNullOrWhiteSpace(textBox_MinecraftFolder.Text) /*|| modpackInfo.Valid*/) { - SetStatus(LangRes.StatusText_MinecraftProfileWarning, AppGlobals.Symbols.GetPixbuf(AppSymbols.general_warning_sign, SymbolSize.Small)); + SetStatus(LangRes.StatusText_MinecraftProfileWarning, Program.Symbols.GetPixbuf(AppSymbols.general_warning_sign, SymbolSize.Small)); button_CheckForUpdates.Sensitive = false; button_Install.Sensitive = false; return false; } else if (updateConfig == null || string.IsNullOrWhiteSpace(textBox_ModpackUrl.Text)) { - SetStatus(LangRes.StatusText_ConfigIncompleteOrNotLoaded, AppGlobals.Symbols.GetPixbuf(AppSymbols.general_warning_sign, SymbolSize.Small)); + SetStatus(LangRes.StatusText_ConfigIncompleteOrNotLoaded, Program.Symbols.GetPixbuf(AppSymbols.general_warning_sign, SymbolSize.Small)); button_CheckForUpdates.Sensitive = false; button_Install.Sensitive = false; return false; } else if (updateConfig.Maintenance && !updateOptions.IgnoreMaintenance) { - SetStatus(LangRes.StatusText_Maintenance, AppGlobals.Symbols.GetPixbuf(AppSymbols.services, SymbolSize.Small)); + SetStatus(LangRes.StatusText_Maintenance, Program.Symbols.GetPixbuf(AppSymbols.services, SymbolSize.Small)); button_CheckForUpdates.Sensitive = false; button_Install.Sensitive = false; return false; @@ -243,28 +242,28 @@ internal class MainWindow : Window void error() { - SetStatus(LangRes.StatusText_ErrorWhileUpdateCheckOrUpdate, AppGlobals.Symbols.GetPixbuf(AppSymbols.close, SymbolSize.Small)); + SetStatus(LangRes.StatusText_ErrorWhileUpdateCheckOrUpdate, Program.Symbols.GetPixbuf(AppSymbols.close, SymbolSize.Small)); currentUpdating = false; } void installing() { - SetStatus(LangRes.StatusText_Installing, AppGlobals.Symbols.GetPixbuf(AppSymbols.software_installer, SymbolSize.Small)); + SetStatus(LangRes.StatusText_Installing, Program.Symbols.GetPixbuf(AppSymbols.software_installer, SymbolSize.Small)); currentUpdating = true; } void updatesAvailable() { - SetStatus(LangRes.StatusText_UpdateAvailable, AppGlobals.Symbols.GetPixbuf(AppSymbols.software_installer, SymbolSize.Small)); + SetStatus(LangRes.StatusText_UpdateAvailable, Program.Symbols.GetPixbuf(AppSymbols.software_installer, SymbolSize.Small)); } void everythingOk() { - SetStatus(LangRes.StatusTest_EverythingOk, AppGlobals.Symbols.GetPixbuf(AppSymbols.done, SymbolSize.Small)); + SetStatus(LangRes.StatusTest_EverythingOk, Program.Symbols.GetPixbuf(AppSymbols.done, SymbolSize.Small)); currentUpdating = false; } // Check only if not pressed "install", not really needed otherwise. if (lastUpdateCheckResult is null || !doInstall || repair) { - SetStatus(LangRes.StatusText_CheckingForUpdates, AppGlobals.Symbols.GetPixbuf(AppSymbols.update_done, SymbolSize.Small)); + SetStatus(LangRes.StatusText_CheckingForUpdates, Program.Symbols.GetPixbuf(AppSymbols.update_done, SymbolSize.Small)); // Check for extras once again updateOptions.IncludeExtras = features.IsEnabled(ModpackFeatures.FeatureAllowExtas, new AllowExtrasFeatureContext(modpackInfo)); @@ -335,13 +334,13 @@ internal class MainWindow : Window private void Updated_CheckingProgresssUpdated(int toCheck, int processed) { - SetStatus(Math.Round(processed / (double)toCheck * 100d, 1) + "%", AppGlobals.Symbols.GetPixbuf(AppSymbols.update_done, SymbolSize.Small)); + SetStatus(Math.Round(processed / (double)toCheck * 100d, 1) + "%", Program.Symbols.GetPixbuf(AppSymbols.update_done, SymbolSize.Small)); } private void Update_InstallProgessUpdated(UpdateCheckResult result, int processedSyncs) { int actionCount = result.Actions.Count; - SetStatus(Math.Round(processedSyncs / (double)actionCount * 100d, 1) + "%", AppGlobals.Symbols.GetPixbuf(AppSymbols.software_installer, SymbolSize.Small)); + SetStatus(Math.Round(processedSyncs / (double)actionCount * 100d, 1) + "%", Program.Symbols.GetPixbuf(AppSymbols.software_installer, SymbolSize.Small)); } #endregion diff --git a/ModpackUpdater.Apps.Client/ModpackUpdater.Apps.Client.csproj b/ModpackUpdater.Apps.Client/ModpackUpdater.Apps.Client.csproj index 49dea21..7b37d65 100644 --- a/ModpackUpdater.Apps.Client/ModpackUpdater.Apps.Client.csproj +++ b/ModpackUpdater.Apps.Client/ModpackUpdater.Apps.Client.csproj @@ -48,7 +48,7 @@ - + diff --git a/ModpackUpdater.Apps.Client/Program.cs b/ModpackUpdater.Apps.Client/Program.cs index 7edbaff..d18269f 100644 --- a/ModpackUpdater.Apps.Client/Program.cs +++ b/ModpackUpdater.Apps.Client/Program.cs @@ -1,9 +1,11 @@ using Castle.Core.Logging; using Gtk; +using Microsoft.Win32; using ModpackUpdater.Manager; using Newtonsoft.Json; using Pilz; using Pilz.Configuration; +using Pilz.UI.Gtk.Symbols; using System.Diagnostics; using System.Runtime.InteropServices; using System.Text; @@ -18,10 +20,9 @@ public static class Program private static readonly ILogger log = new ConsoleLogger(); private static Application uiApp; + public static IGtkSymbolFactory Symbols { get; } = new AppSymbolFactory(); public static ISettings Settings => settingsManager.Instance; - public static ILogger Log => log; - internal static Options Options { get; private set; } [DllImport("kernel32.dll")] @@ -54,6 +55,9 @@ public static class Program private static void RunApp(UpdateCheckOptionsAdv updateOptions) { + if (UsesWindowsDarkTheme()) + Environment.SetEnvironmentVariable("GTK_THEME", "Adwaita:dark"); + Application.Init(); uiApp = new Application("ModpackUpdater.Apps.Client", GLib.ApplicationFlags.None); @@ -170,4 +174,19 @@ public static class Program return info.ConfigUrl; return configUrl; } + + private static bool UsesWindowsDarkTheme() + { + if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows)) + { + try + { + return Registry.CurrentUser.OpenSubKey("Software\\Microsoft\\Windows\\CurrentVersion\\Themes\\Personalize")?.GetValue("AppsUseLightTheme") as bool? ?? default; + } + catch (Exception) + { + } + } + return default; + } } diff --git a/ModpackUpdater.Apps.Manager/Api/Model/IMainApi.cs b/ModpackUpdater.Apps.Manager/Api/Model/IMainApi.cs index 33ba8fc..4350cda 100644 --- a/ModpackUpdater.Apps.Manager/Api/Model/IMainApi.cs +++ b/ModpackUpdater.Apps.Manager/Api/Model/IMainApi.cs @@ -3,7 +3,7 @@ public interface IMainApi { IWorkspace? CurWorkspace { get; } - + IActionSetInfos? CurActionSet { get; } Form MainWindow { get; } diff --git a/ModpackUpdater.Apps.Manager/Api/Plugins/Features/WorkspaceFeature.cs b/ModpackUpdater.Apps.Manager/Api/Plugins/Features/WorkspaceFeature.cs index 7ed5c0d..24b675a 100644 --- a/ModpackUpdater.Apps.Manager/Api/Plugins/Features/WorkspaceFeature.cs +++ b/ModpackUpdater.Apps.Manager/Api/Plugins/Features/WorkspaceFeature.cs @@ -18,7 +18,7 @@ public abstract class WorkspaceFeature(string identifier, string name) : PluginF return false; workspace.Config.ProviderId = Identifier; - + return true; } diff --git a/ModpackUpdater.Apps.Manager/AppSymbolFactory.cs b/ModpackUpdater.Apps.Manager/AppSymbolFactory.cs new file mode 100644 index 0000000..77ab514 --- /dev/null +++ b/ModpackUpdater.Apps.Manager/AppSymbolFactory.cs @@ -0,0 +1,17 @@ +using Pilz.UI.WinForms.Telerik.Symbols; +using System.Reflection; + +namespace ModpackUpdater.Apps.Manager; + +internal class AppSymbolFactory : RadSymbolFactory +{ + public override Assembly GetImageResourceAssembly() + { + return typeof(AppSymbols).Assembly; + } + + public override string GetImageRessourcePath(AppSymbols svgImage) + { + return $"{typeof(AppSymbols).Namespace}.Symbols.{svgImage}.svg"; + } +} diff --git a/ModpackUpdater.Apps.Manager/Features/CM/CheckSingleActionHealthyFeature.cs b/ModpackUpdater.Apps.Manager/Features/CM/CheckSingleActionHealthyFeature.cs index 331318d..1153382 100644 --- a/ModpackUpdater.Apps.Manager/Features/CM/CheckSingleActionHealthyFeature.cs +++ b/ModpackUpdater.Apps.Manager/Features/CM/CheckSingleActionHealthyFeature.cs @@ -12,7 +12,7 @@ internal class CheckSingleActionHealthyFeature : PluginFunction, IPluginFeatureP public CheckSingleActionHealthyFeature() : base(FeatureTypes.ActionsContextMenu, "origin.checksingleactionhearlthy", FeatureNamesLangRes.CheckSingleActionHealthy) { - Icon = AppGlobals.Symbols.GetSvgImage(AppSymbols.heart_with_pulse, Pilz.UI.Symbols.SymbolSize.Small); + Icon = Program.Symbols.GetSvgImage(AppSymbols.heart_with_pulse, Pilz.UI.Symbols.SymbolSize.Small); } protected override object? ExecuteFunction(PluginFunctionParameter? @params) diff --git a/ModpackUpdater.Apps.Manager/Features/CM/ClearDirectLinkFeature.cs b/ModpackUpdater.Apps.Manager/Features/CM/ClearDirectLinkFeature.cs index 08ba1a3..47a73c8 100644 --- a/ModpackUpdater.Apps.Manager/Features/CM/ClearDirectLinkFeature.cs +++ b/ModpackUpdater.Apps.Manager/Features/CM/ClearDirectLinkFeature.cs @@ -12,7 +12,7 @@ internal class ClearDirectLinkFeature : PluginFunction, IPluginFeatureProvider - - - - - - - - - - + + + + + + + + + + + + diff --git a/ModpackUpdater.Apps.Manager/Program.cs b/ModpackUpdater.Apps.Manager/Program.cs index 8864a2c..39a016f 100644 --- a/ModpackUpdater.Apps.Manager/Program.cs +++ b/ModpackUpdater.Apps.Manager/Program.cs @@ -2,6 +2,10 @@ using OfficeOpenXml; using Pilz; using Pilz.Configuration; using Pilz.Plugins.Advanced; +using Pilz.UI.WinForms.Telerik.Dialogs; +using Pilz.UI.WinForms.Telerik.Symbols; +using Pilz.UI.WinForms.Telerik.Theming; +using Telerik.WinControls.Themes; [assembly: AssemblyAppVersion("1.0.0.0")] @@ -9,13 +13,15 @@ namespace ModpackUpdater.Apps.Manager; public static class Program { + public static IRadSymbolFactory Symbols { get; } = new AppSymbolFactory(); + private static readonly SettingsManager settingsManager; public static ISettings Settings => settingsManager.Instance; static Program() { - ExcelPackage.LicenseContext = LicenseContext.NonCommercial; + ExcelPackage.License.SetNonCommercialPersonal("Pilzinsel64"); settingsManager = new(GetSettingsPath(), true); } @@ -28,7 +34,14 @@ public static class Program // To customize application configuration such as set high DPI settings or default font, // see https://aka.ms/applicationconfiguration. ApplicationConfiguration.Initialize(); - AppGlobals.Initialize(); + ThemeHelper.ApplyApplicationTheme(new ThemeDefinition(ApplicationTheme.Auto, HighContrastMode.Auto), n => n.Theme switch + { + ApplicationTheme.Light => new Windows11CompactTheme(), + ApplicationTheme.Gray or ApplicationTheme.Dark => new Windows11CompactDarkTheme(), + _ => throw new NotImplementedException(), + }); + RadFlyoutBase.ConfirmSvg = Symbols.GetSvgImage(AppSymbols.checkmark, Pilz.UI.Symbols.SymbolSize.Small); + RadFlyoutBase.CancelSvg = Symbols.GetSvgImage(AppSymbols.cancel, Pilz.UI.Symbols.SymbolSize.Small); PluginFeatureController.Instance.RegisterAllOwn(); Application.Run(new Ui.MainForm()); } diff --git a/ModpackUpdater.Apps.Manager/Ui/MainForm.cs b/ModpackUpdater.Apps.Manager/Ui/MainForm.cs index a4b2b06..bb3e426 100644 --- a/ModpackUpdater.Apps.Manager/Ui/MainForm.cs +++ b/ModpackUpdater.Apps.Manager/Ui/MainForm.cs @@ -4,11 +4,11 @@ using ModpackUpdater.Apps.Manager.Api.Plugins.Params; using ModpackUpdater.Apps.Manager.LangRes; using ModpackUpdater.Apps.Manager.Settings; using Pilz.Plugins.Advanced; -using Pilz.Plugins.Advanced.UI.Telerik; -using Pilz.UI.Extensions; +using Pilz.Plugins.Advanced.UI.WinForms.Telerik; using Pilz.UI.Symbols; -using Pilz.UI.Telerik.Dialogs; -using Pilz.UI.Telerik.Extensions.Extensions; +using Pilz.UI.WinForms.Extensions; +using Pilz.UI.WinForms.Telerik.Dialogs; +using Pilz.UI.WinForms.Telerik.Extensions; using Telerik.WinControls; using Telerik.WinControls.UI; @@ -32,16 +32,16 @@ public partial class MainForm : RadForm, IMainApi { InitializeComponent(); - radMenuItem_Workspace.SvgImage = AppGlobals.Symbols.GetSvgImage(AppSymbols.workspace, SymbolSize.Small); - radMenuItem_WorkspacePreferences.SvgImage = AppGlobals.Symbols.GetSvgImage(AppSymbols.settings, SymbolSize.Small); - radMenuItem_SaveWorkspace.SvgImage = AppGlobals.Symbols.GetSvgImage(AppSymbols.save, SymbolSize.Small); - radMenuItem_OpenNewWorkspace.SvgImage = AppGlobals.Symbols.GetSvgImage(AppSymbols.new_window, SymbolSize.Small); - radMenuItem_RecentWorkspaces.SvgImage = AppGlobals.Symbols.GetSvgImage(AppSymbols.time_machine, SymbolSize.Small); - radMenuItem_Updates.SvgImage = AppGlobals.Symbols.GetSvgImage(AppSymbols.update_done, SymbolSize.Small); - radMenuItem_EditUpdate.SvgImage = AppGlobals.Symbols.GetSvgImage(AppSymbols.edit, SymbolSize.Small); - radMenuItem_CreateUpdate.SvgImage = AppGlobals.Symbols.GetSvgImage(AppSymbols.add, SymbolSize.Small); - radMenuItem_RemoveUpdate.SvgImage = AppGlobals.Symbols.GetSvgImage(AppSymbols.remove, SymbolSize.Small); - radMenuItem_Tools.SvgImage = AppGlobals.Symbols.GetSvgImage(AppSymbols.tools, SymbolSize.Small); + radMenuItem_Workspace.SvgImage = Program.Symbols.GetSvgImage(AppSymbols.workspace, SymbolSize.Small); + radMenuItem_WorkspacePreferences.SvgImage = Program.Symbols.GetSvgImage(AppSymbols.settings, SymbolSize.Small); + radMenuItem_SaveWorkspace.SvgImage = Program.Symbols.GetSvgImage(AppSymbols.save, SymbolSize.Small); + radMenuItem_OpenNewWorkspace.SvgImage = Program.Symbols.GetSvgImage(AppSymbols.new_window, SymbolSize.Small); + radMenuItem_RecentWorkspaces.SvgImage = Program.Symbols.GetSvgImage(AppSymbols.time_machine, SymbolSize.Small); + radMenuItem_Updates.SvgImage = Program.Symbols.GetSvgImage(AppSymbols.update_done, SymbolSize.Small); + radMenuItem_EditUpdate.SvgImage = Program.Symbols.GetSvgImage(AppSymbols.edit, SymbolSize.Small); + radMenuItem_CreateUpdate.SvgImage = Program.Symbols.GetSvgImage(AppSymbols.add, SymbolSize.Small); + radMenuItem_RemoveUpdate.SvgImage = Program.Symbols.GetSvgImage(AppSymbols.remove, SymbolSize.Small); + radMenuItem_Tools.SvgImage = Program.Symbols.GetSvgImage(AppSymbols.tools, SymbolSize.Small); radMenuItem_SaveWorkspace.Shortcuts.Add(new(Keys.Control, Keys.S)); @@ -170,7 +170,7 @@ public partial class MainForm : RadForm, IMainApi else item.Text = infos.Version.ToString(); - item.SvgImage = AppGlobals.Symbols.GetSvgImage(infos.IsPublic ? AppSymbols.eye : AppSymbols.invisible, SymbolSize.Small); + item.SvgImage = Program.Symbols.GetSvgImage(infos.IsPublic ? AppSymbols.eye : AppSymbols.invisible, SymbolSize.Small); } public void UpdateItem(IActionSetInfos actionSetInfos) @@ -426,8 +426,8 @@ public partial class MainForm : RadForm, IMainApi //{ // cellElement.SvgImage = sourceType switch // { - // SourceType.DirectLink => AppGlobals.Symbols.GetSvgImage(AppSymbols.link, SymbolSize.Small), - // SourceType.GitHub => AppGlobals.Symbols.GetSvgImage(AppSymbols.github, SymbolSize.Small), + // SourceType.DirectLink => Program.Symbols.GetSvgImage(AppSymbols.link, SymbolSize.Small), + // SourceType.GitHub => Program.Symbols.GetSvgImage(AppSymbols.github, SymbolSize.Small), // _ => null, // }; // cellElement.DrawImage = cellElement.SvgImage != null; @@ -536,7 +536,7 @@ public partial class MainForm : RadForm, IMainApi private void RadMenuItem_EditUpdate_Click(object sender, EventArgs e) { if (radListControl_Updates.SelectedItem?.Value is IActionSetInfos infos - && RadDialogBase.ShowDialog(new UpdatePropertiesEditorFlyout(infos), TitlesLangRes.EditUpdate, AppGlobals.Symbols.GetSvgImage(AppSymbols.edit, SymbolSize.Small)).IsValid()) + && RadDialogBase.ShowDialog(new UpdatePropertiesEditorFlyout(infos), TitlesLangRes.EditUpdate, Program.Symbols.GetSvgImage(AppSymbols.edit, SymbolSize.Small)).IsValid()) UpdateUpdateItem(radListControl_Updates.SelectedItem); } @@ -545,7 +545,7 @@ public partial class MainForm : RadForm, IMainApi var infos = new UpdateInfo(); if (wsInfo?.Workspace.UpdateInfos is not null - && RadDialogBase.ShowDialog(new UpdatePropertiesEditorFlyout(infos), TitlesLangRes.EditUpdate, AppGlobals.Symbols.GetSvgImage(AppSymbols.edit, SymbolSize.Small)).IsValid()) + && RadDialogBase.ShowDialog(new UpdatePropertiesEditorFlyout(infos), TitlesLangRes.EditUpdate, Program.Symbols.GetSvgImage(AppSymbols.edit, SymbolSize.Small)).IsValid()) { wsInfo.Workspace.UpdateInfos.Updates.Insert(0, infos); InsertUpdateItem(infos); diff --git a/ModpackUpdater.Apps.Manager/Ui/UpdatePropertiesEditorFlyout.cs b/ModpackUpdater.Apps.Manager/Ui/UpdatePropertiesEditorFlyout.cs index 154c44c..b580cc3 100644 --- a/ModpackUpdater.Apps.Manager/Ui/UpdatePropertiesEditorFlyout.cs +++ b/ModpackUpdater.Apps.Manager/Ui/UpdatePropertiesEditorFlyout.cs @@ -1,5 +1,5 @@ using Pilz.UI; -using Pilz.UI.Telerik.Dialogs; +using Pilz.UI.WinForms.Telerik.Dialogs; namespace ModpackUpdater.Apps.Manager.Ui; diff --git a/ModpackUpdater.Apps/AppGlobals.cs b/ModpackUpdater.Apps/AppGlobals.cs deleted file mode 100644 index 6743791..0000000 --- a/ModpackUpdater.Apps/AppGlobals.cs +++ /dev/null @@ -1,34 +0,0 @@ -using Microsoft.Win32; -using Pilz.UI.Gtk.Symbols; -using System.Runtime.InteropServices; - -namespace ModpackUpdater.Apps; - -public static class AppGlobals -{ - public static IGtkSymbolFactory Symbols { get; } = new AppSymbolFactory(); - - public static void Initialize() - { - if (UsesWindowsDarkTheme()) - Environment.SetEnvironmentVariable("GTK_THEME", "Adwaita:dark"); - - //RadFlyoutBase.ConfirmSvg = Symbols.GetSvgImage(AppSymbols.checkmark, Pilz.UI.Symbols.SymbolSize.Small); - //RadFlyoutBase.CancelSvg = Symbols.GetSvgImage(AppSymbols.cancel, Pilz.UI.Symbols.SymbolSize.Small); - } - - private static bool UsesWindowsDarkTheme() - { - if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows)) - { - try - { - return Registry.CurrentUser.OpenSubKey("Software\\Microsoft\\Windows\\CurrentVersion\\Themes\\Personalize")?.GetValue("AppsUseLightTheme") as bool? ?? default; - } - catch (Exception) - { - } - } - return default; - } -} diff --git a/ModpackUpdater.Apps/ModpackUpdater.Apps.csproj b/ModpackUpdater.Apps/ModpackUpdater.Apps.csproj index f664a61..f62c17f 100644 --- a/ModpackUpdater.Apps/ModpackUpdater.Apps.csproj +++ b/ModpackUpdater.Apps/ModpackUpdater.Apps.csproj @@ -11,7 +11,7 @@ - + diff --git a/ModpackUpdater.Manager/Extensions.cs b/ModpackUpdater.Manager/Extensions.cs index 0fcee99..ca8e845 100644 --- a/ModpackUpdater.Manager/Extensions.cs +++ b/ModpackUpdater.Manager/Extensions.cs @@ -55,7 +55,7 @@ public static class Extensions if (!string.IsNullOrWhiteSpace(overwriteRefTag)) return @this.InstallUrl?.Replace("{ref}", overwriteRefTag); if (!string.IsNullOrWhiteSpace(@this.RefTag)) - return @this.InstallUrl?.Replace("{ref}", @this.RefTag); + return @this.InstallUrl?.Replace("{ref}", @this.RefTag); return @this.InstallUrl; } diff --git a/ModpackUpdater.Manager/ModpackInstaller.cs b/ModpackUpdater.Manager/ModpackInstaller.cs index 06e08e2..f086254 100644 --- a/ModpackUpdater.Manager/ModpackInstaller.cs +++ b/ModpackUpdater.Manager/ModpackInstaller.cs @@ -163,7 +163,7 @@ public class ModpackInstaller(ModpackConfig updateConfig, ModpackInfo modpackInf switch (uaction.Type) { case UpdateActionType.Update: - if (!await InstallFile(destFilePath, sourceUrl, uaction.IsZip, uaction.ZipPath, localZipCache)) + if (!await InstallFile(destFilePath, sourceUrl, uaction.IsZip, uaction.ZipPath, localZipCache)) return false; break; case UpdateActionType.Delete: diff --git a/ModpackUpdater/InstallOption.cs b/ModpackUpdater/InstallOption.cs index 6a4f06a..b8578ac 100644 --- a/ModpackUpdater/InstallOption.cs +++ b/ModpackUpdater/InstallOption.cs @@ -1,10 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace ModpackUpdater; +namespace ModpackUpdater; public class InstallOption {