From 46179463e13ffd8a67428797fa401fc4ba571259 Mon Sep 17 00:00:00 2001 From: Pilzinsel64 Date: Thu, 5 Sep 2024 14:53:39 +0200 Subject: [PATCH] migration due nuget updates --- ModpackUpdater/AppSymbolFactory.cs | 9 ++++---- ModpackUpdater/AppUpdater.cs | 2 +- ModpackUpdater/Form1.cs | 35 +++++++++++++++--------------- 3 files changed, 24 insertions(+), 22 deletions(-) diff --git a/ModpackUpdater/AppSymbolFactory.cs b/ModpackUpdater/AppSymbolFactory.cs index f219305..da08cd4 100644 --- a/ModpackUpdater/AppSymbolFactory.cs +++ b/ModpackUpdater/AppSymbolFactory.cs @@ -1,18 +1,19 @@ using Pilz.UI.Telerik; +using Pilz.UI.Telerik.Symbols; using System.Reflection; namespace ModpackUpdater; -public class AppSymbolFactory : SymbolFactory +public class AppSymbolFactory : RadSymbolFactory { - public static AppSymbolFactory Instance { get; } = new(); + public static IRadSymbolFactory Instance { get; } = new AppSymbolFactory(); - public override Assembly GetSvgImageResourceAssembly() + public override Assembly GetImageResourceAssembly() { return Assembly.GetExecutingAssembly(); } - public override string GetSvgImageRessourcePath(AppSymbols svgImage) + public override string GetImageRessourcePath(AppSymbols svgImage) { return $"{GetType().Namespace}.Symbols.{svgImage}.svg"; } diff --git a/ModpackUpdater/AppUpdater.cs b/ModpackUpdater/AppUpdater.cs index fe2e0be..6ebd533 100644 --- a/ModpackUpdater/AppUpdater.cs +++ b/ModpackUpdater/AppUpdater.cs @@ -41,7 +41,7 @@ public class AppUpdater { var client = new HttpClient(); var tempFileName = Path.GetTempFileName(); - var appFileName = Pilz.IO.Extensions.GetExecutablePath(); + var appFileName = Pilz.Win32.NativeTools.GetExecutablePath(); var oldFileName = appFileName + ".old"; // Delete old file diff --git a/ModpackUpdater/Form1.cs b/ModpackUpdater/Form1.cs index 2c724e8..15ba6e5 100644 --- a/ModpackUpdater/Form1.cs +++ b/ModpackUpdater/Form1.cs @@ -1,6 +1,7 @@ using ModpackUpdater.Manager; using ModpackUpdater.Model; using ModpackUpdater.My.Resources; +using Pilz.UI.Symbols; using Pilz.UI.Telerik; using System.Diagnostics; using System.Reflection; @@ -34,12 +35,12 @@ public partial class Form1 Text = $"{Text} (v{Assembly.GetExecutingAssembly().GetName().Version})"; - RadButton_Install.SvgImage = AppSymbolFactory.Instance.GetSvgImage(AppSymbols.software_installer, SvgImageSize.Small); - RadButton_CheckForUpdates.SvgImage = AppSymbolFactory.Instance.GetSvgImage(AppSymbols.update_done, SvgImageSize.Small); - radButton_RefreshConfig.SvgImage = AppSymbolFactory.Instance.GetSvgImage(AppSymbols.refresh, SvgImageSize.Small); - RadButton_SearchMinecraftProfileFolder.SvgImage = AppSymbolFactory.Instance.GetSvgImage(AppSymbols.opened_folder, SvgImageSize.Small); - radButton_PasteInstallKey.SvgImage = AppSymbolFactory.Instance.GetSvgImage(AppSymbols.paste, SvgImageSize.Small); - RadButton_PasteModpackConfig.SvgImage = AppSymbolFactory.Instance.GetSvgImage(AppSymbols.paste, SvgImageSize.Small); + RadButton_Install.SvgImage = AppSymbolFactory.Instance.GetSvgImage(AppSymbols.software_installer, SymbolSize.Small); + RadButton_CheckForUpdates.SvgImage = AppSymbolFactory.Instance.GetSvgImage(AppSymbols.update_done, SymbolSize.Small); + radButton_RefreshConfig.SvgImage = AppSymbolFactory.Instance.GetSvgImage(AppSymbols.refresh, SymbolSize.Small); + RadButton_SearchMinecraftProfileFolder.SvgImage = AppSymbolFactory.Instance.GetSvgImage(AppSymbols.opened_folder, SymbolSize.Small); + radButton_PasteInstallKey.SvgImage = AppSymbolFactory.Instance.GetSvgImage(AppSymbols.paste, SymbolSize.Small); + RadButton_PasteModpackConfig.SvgImage = AppSymbolFactory.Instance.GetSvgImage(AppSymbols.paste, SymbolSize.Small); } private void LoadMinecraftProfile(string folderPath) @@ -107,7 +108,7 @@ public partial class Form1 if (modpackInfo == null || string.IsNullOrWhiteSpace(RadTextBoxControl_MinecraftProfileFolder.Text) /*|| modpackInfo.Valid*/) { - SetStatus(LangRes.StatusText_MinecraftProfileWarning, AppSymbolFactory.Instance.GetSvgImage(AppSymbols.general_warning_sign, SvgImageSize.Small)); + SetStatus(LangRes.StatusText_MinecraftProfileWarning, AppSymbolFactory.Instance.GetSvgImage(AppSymbols.general_warning_sign, SymbolSize.Small)); RadButton_PasteModpackConfig.Enabled = false; radButton_PasteInstallKey.Enabled = false; RadButton_CheckForUpdates.Enabled = false; @@ -116,7 +117,7 @@ public partial class Form1 } else if (updateConfig == null || string.IsNullOrWhiteSpace(RadTextBoxControl_ModpackConfig.Text)) { - SetStatus(LangRes.StatusText_ConfigIncompleteOrNotLoaded, AppSymbolFactory.Instance.GetSvgImage(AppSymbols.general_warning_sign, SvgImageSize.Small)); + SetStatus(LangRes.StatusText_ConfigIncompleteOrNotLoaded, AppSymbolFactory.Instance.GetSvgImage(AppSymbols.general_warning_sign, SymbolSize.Small)); RadButton_PasteModpackConfig.Enabled = true; radButton_PasteInstallKey.Enabled = false; RadButton_CheckForUpdates.Enabled = false; @@ -125,7 +126,7 @@ public partial class Form1 } else if (updateConfig.Maintenance && !updateOptions.IgnoreMaintenance) { - SetStatus(LangRes.StatusText_Maintenance, AppSymbolFactory.Instance.GetSvgImage(AppSymbols.services, SvgImageSize.Small)); + SetStatus(LangRes.StatusText_Maintenance, AppSymbolFactory.Instance.GetSvgImage(AppSymbols.services, SymbolSize.Small)); RadButton_PasteModpackConfig.Enabled = true; radButton_PasteInstallKey.Enabled = true; RadButton_CheckForUpdates.Enabled = false; @@ -148,28 +149,28 @@ public partial class Form1 void error() { - SetStatus(LangRes.StatusText_ErrorWhileUpdateCheckOrUpdate, AppSymbolFactory.Instance.GetSvgImage(AppSymbols.close, SvgImageSize.Small)); + SetStatus(LangRes.StatusText_ErrorWhileUpdateCheckOrUpdate, AppSymbolFactory.Instance.GetSvgImage(AppSymbols.close, SymbolSize.Small)); currentUpdating = false; } void installing() { - SetStatus(LangRes.StatusText_Installing, AppSymbolFactory.Instance.GetSvgImage(AppSymbols.software_installer, SvgImageSize.Small)); + SetStatus(LangRes.StatusText_Installing, AppSymbolFactory.Instance.GetSvgImage(AppSymbols.software_installer, SymbolSize.Small)); currentUpdating = true; } void updatesAvailable() { - SetStatus(LangRes.StatusText_UpdateAvailable, AppSymbolFactory.Instance.GetSvgImage(AppSymbols.software_installer, SvgImageSize.Small)); + SetStatus(LangRes.StatusText_UpdateAvailable, AppSymbolFactory.Instance.GetSvgImage(AppSymbols.software_installer, SymbolSize.Small)); } void everythingOk() { - SetStatus(LangRes.StatusTest_EverythingOk, AppSymbolFactory.Instance.GetSvgImage(AppSymbols.done, SvgImageSize.Small)); + SetStatus(LangRes.StatusTest_EverythingOk, AppSymbolFactory.Instance.GetSvgImage(AppSymbols.done, SymbolSize.Small)); currentUpdating = false; } // Check only if not pressed "install", not really needed otherwise. if (lastUpdateCheckResult is null || !doInstall) { - SetStatus(LangRes.StatusText_CheckingForUpdates, AppSymbolFactory.Instance.GetSvgImage(AppSymbols.update_done, SvgImageSize.Small)); + SetStatus(LangRes.StatusText_CheckingForUpdates, AppSymbolFactory.Instance.GetSvgImage(AppSymbols.update_done, SymbolSize.Small)); // Check for extras once again updateOptions.IncludeExtras = features.IsEnabled(ModpackFeatures.FeatureAllowExtas, new AllowExtrasFeatureContext(modpackInfo)); @@ -238,12 +239,12 @@ public partial class Form1 private void Update_InstallProgessUpdated(UpdateCheckResult result, int processedSyncs) { int actionCount = result.Actions.Count; - SetStatus(Math.Round(processedSyncs / (double)actionCount * 100d, 1) + "%", AppSymbolFactory.Instance.GetSvgImage(AppSymbols.software_installer, SvgImageSize.Small)); + SetStatus(Math.Round(processedSyncs / (double)actionCount * 100d, 1) + "%", AppSymbolFactory.Instance.GetSvgImage(AppSymbols.software_installer, SymbolSize.Small)); } private void Updated_CheckingProgresssUpdated(int toCheck, int processed) { - SetStatus(Math.Round(processed / (double)toCheck * 100d, 1) + "%", AppSymbolFactory.Instance.GetSvgImage(AppSymbols.update_done, SvgImageSize.Small)); + SetStatus(Math.Round(processed / (double)toCheck * 100d, 1) + "%", AppSymbolFactory.Instance.GetSvgImage(AppSymbols.update_done, SymbolSize.Small)); } private void ButtonX_SearchMinecraftProfile_Click(object sender, EventArgs e) @@ -299,7 +300,7 @@ public partial class Form1 var updater = new AppUpdater(); if (!updateOptions.NoUpdate && await updater.Check() && RadMessageBox.Show(LangRes.MsgBox_UpdateAvailable, LangRes.MsgBox_UpdateAvailable_Title, MessageBoxButtons.YesNo, RadMessageIcon.Info) == DialogResult.Yes) { - SetStatus(LangRes.StatusText_InstallingAppUpdate, AppSymbolFactory.Instance.GetSvgImage(AppSymbols.software_installer, SvgImageSize.Small)); + SetStatus(LangRes.StatusText_InstallingAppUpdate, AppSymbolFactory.Instance.GetSvgImage(AppSymbols.software_installer, SymbolSize.Small)); Enabled = false; await updater.Install(); Application.Restart();