From 07853467b1a24a0869cad1bc3e6d3beef38377b8 Mon Sep 17 00:00:00 2001 From: Pilzinsel64 Date: Wed, 26 Jun 2024 17:24:08 +0200 Subject: [PATCH] rework client and remove separated update installer (gui not finished yet) --- .../Pilz.Updating.Client.GUI.csproj | 39 +++- .../SimpleActionDialog.Designer.cs | 2 +- .../SimpleActionDialog.cs | 2 +- Pilz.Updating.Client.GUI/UpdateClientGUI.cs | 123 ++++++---- .../LangRes/GeneralLangRes.Designer.cs | 8 +- .../LangRes/GeneralLangRes.resx | 0 .../UpdateInstallerLangRes.Designer.cs | 6 +- .../UpdateInstallerLangRes.de.Designer.cs | 0 .../LangRes/UpdateInstallerLangRes.de.resx | 0 .../LangRes/UpdateInstallerLangRes.resx | 0 .../UpdatingClientGuiLangRes.Designer.cs | 2 +- .../LangRes}/UpdatingClientGuiLangRes.de.resx | 0 .../LangRes}/UpdatingClientGuiLangRes.resx | 0 .../Pilz - Backup.Updating.Client.GUI.csproj | 118 +++++----- .../UpdateWindow.Designer.cs | 58 ++--- Pilz.Updating.Client.Gui/UpdateWindow.cs | 115 +++++++++ .../UpdateWindow.resx | 0 Pilz.Updating.Client/Delegates.cs | 4 + Pilz.Updating.Client/General.cs | 46 ++++ Pilz.Updating.Client/UpdateClient.cs | 219 +++++++----------- Pilz.Updating.Client/UpdateClientEventArgs.cs | 8 + Pilz.Updating.Client/UpdateStatus.cs | 12 +- Pilz.Updating.Client/UpdateStatusEvent.cs | 8 + Pilz.Updating.Client/UpdateStatusEventArgs.cs | 11 + Pilz.Updating.Client/Utils.cs | 5 + .../Pilz.Updating.UpdateInstaller.Lib.csproj | 18 -- .../UpdateInstaller.cs | 172 -------------- .../UpdateInstallerEventArgs.cs | 6 - .../UpdateInstallerStatus.cs | 11 - .../UpdateInstallerStatusChangedEventArgs.cs | 11 - .../UpdateInstallerStep.cs | 10 - .../UpdateInstallerStepEventArgs.cs | 13 -- .../UpdateInstallerStepState.cs | 8 - Pilz.Updating.UpdateInstaller/App.config | 9 - Pilz.Updating.UpdateInstaller/General.cs | 32 --- Pilz.Updating.UpdateInstaller/Main.cs | 142 ------------ .../MyIcons.Designer.cs | 203 ---------------- Pilz.Updating.UpdateInstaller/MyIcons.resx | 163 ------------- Pilz.Updating.UpdateInstaller/Program.cs | 12 - .../Properties/AssemblyInfo.cs | 7 - .../PublishProfiles/FolderProfile.pubxml | 18 -- .../Properties/Resources.Designer.cs | 63 ----- .../Properties/Resources.resx | 120 ---------- .../Properties/Settings.Designer.cs | 26 --- .../Properties/Settings.settings | 7 - .../Resources/icons8_checkmark_16px.png | Bin 337 -> 0 bytes .../Resources/icons8_console_16px_1.png | Bin 301 -> 0 bytes .../Resources/icons8_copy_16px.png | Bin 422 -> 0 bytes .../icons8_installing_updates_12px.png | Bin 347 -> 0 bytes .../icons8_installing_updates_16px.png | Bin 454 -> 0 bytes .../icons8_installing_updates_32px.png | Bin 866 -> 0 bytes .../icons8_installing_updates_48px.png | Bin 1217 -> 0 bytes .../Resources/icons8_open_archive_16px.png | Bin 435 -> 0 bytes .../Resources/icons8_recycle_bin_16px.png | Bin 552 -> 0 bytes .../Resources/icons8_sand_timer_16px.png | Bin 470 -> 0 bytes .../icons8_uninstalling_updates_12px.png | Bin 363 -> 0 bytes .../icons8_uninstalling_updates_16px.png | Bin 479 -> 0 bytes .../icons8_uninstalling_updates_32px.png | Bin 873 -> 0 bytes .../icons8_uninstalling_updates_48px.png | Bin 1220 -> 0 bytes .../icons8_software_installer.ico | Bin 32038 -> 0 bytes Pilz.Updating.sln | 20 +- Pilz.Updating/AppVersion.cs | 109 +++++++++ Pilz.Updating/ApplicationVersion.cs | 63 ----- .../Json/AppVersionStringJsonConverter.cs | 82 +++++++ Pilz.Updating/Pilz.Updating.csproj | 1 + Pilz.Updating/UpdateInfo.cs | 1 - .../UpdateInstaller/UpdateInstallerConfig.cs | 28 --- Pilz.Updating/UpdatePackageInfo.cs | 2 +- 68 files changed, 681 insertions(+), 1462 deletions(-) rename Pilz.Updating.Client.GUI/LangRes.Designer.cs => Pilz.Updating.Client.Gui/LangRes/GeneralLangRes.Designer.cs (95%) rename Pilz.Updating.Client.GUI/LangRes.resx => Pilz.Updating.Client.Gui/LangRes/GeneralLangRes.resx (100%) rename Pilz.Updating.UpdateInstaller/UpdateInstallerGuiLangRes.Designer.cs => Pilz.Updating.Client.Gui/LangRes/UpdateInstallerLangRes.Designer.cs (96%) rename Pilz.Updating.UpdateInstaller/UpdateInstallerGuiLangRes.de.Designer.cs => Pilz.Updating.Client.Gui/LangRes/UpdateInstallerLangRes.de.Designer.cs (100%) rename Pilz.Updating.UpdateInstaller/UpdateInstallerGuiLangRes.de.resx => Pilz.Updating.Client.Gui/LangRes/UpdateInstallerLangRes.de.resx (100%) rename Pilz.Updating.UpdateInstaller/UpdateInstallerGuiLangRes.resx => Pilz.Updating.Client.Gui/LangRes/UpdateInstallerLangRes.resx (100%) rename {Pilz.Updating.Client.GUI => Pilz.Updating.Client.Gui/LangRes}/UpdatingClientGuiLangRes.Designer.cs (98%) rename {Pilz.Updating.Client.GUI => Pilz.Updating.Client.Gui/LangRes}/UpdatingClientGuiLangRes.de.resx (100%) rename {Pilz.Updating.Client.GUI => Pilz.Updating.Client.Gui/LangRes}/UpdatingClientGuiLangRes.resx (100%) rename Pilz.Updating.UpdateInstaller/Pilz.Updating.UpdateInstaller.csproj => Pilz.Updating.Client.Gui/Pilz - Backup.Updating.Client.GUI.csproj (52%) rename Pilz.Updating.UpdateInstaller/Main.Designer.cs => Pilz.Updating.Client.Gui/UpdateWindow.Designer.cs (81%) create mode 100644 Pilz.Updating.Client.Gui/UpdateWindow.cs rename Pilz.Updating.UpdateInstaller/Main.resx => Pilz.Updating.Client.Gui/UpdateWindow.resx (100%) create mode 100644 Pilz.Updating.Client/Delegates.cs create mode 100644 Pilz.Updating.Client/General.cs create mode 100644 Pilz.Updating.Client/UpdateClientEventArgs.cs create mode 100644 Pilz.Updating.Client/UpdateStatusEvent.cs create mode 100644 Pilz.Updating.Client/UpdateStatusEventArgs.cs create mode 100644 Pilz.Updating.Client/Utils.cs delete mode 100644 Pilz.Updating.UpdateInstaller.Lib/Pilz.Updating.UpdateInstaller.Lib.csproj delete mode 100644 Pilz.Updating.UpdateInstaller.Lib/UpdateInstaller.cs delete mode 100644 Pilz.Updating.UpdateInstaller.Lib/UpdateInstallerEventArgs.cs delete mode 100644 Pilz.Updating.UpdateInstaller.Lib/UpdateInstallerStatus.cs delete mode 100644 Pilz.Updating.UpdateInstaller.Lib/UpdateInstallerStatusChangedEventArgs.cs delete mode 100644 Pilz.Updating.UpdateInstaller.Lib/UpdateInstallerStep.cs delete mode 100644 Pilz.Updating.UpdateInstaller.Lib/UpdateInstallerStepEventArgs.cs delete mode 100644 Pilz.Updating.UpdateInstaller.Lib/UpdateInstallerStepState.cs delete mode 100644 Pilz.Updating.UpdateInstaller/App.config delete mode 100644 Pilz.Updating.UpdateInstaller/General.cs delete mode 100644 Pilz.Updating.UpdateInstaller/Main.cs delete mode 100644 Pilz.Updating.UpdateInstaller/MyIcons.Designer.cs delete mode 100644 Pilz.Updating.UpdateInstaller/MyIcons.resx delete mode 100644 Pilz.Updating.UpdateInstaller/Program.cs delete mode 100644 Pilz.Updating.UpdateInstaller/Properties/AssemblyInfo.cs delete mode 100644 Pilz.Updating.UpdateInstaller/Properties/PublishProfiles/FolderProfile.pubxml delete mode 100644 Pilz.Updating.UpdateInstaller/Properties/Resources.Designer.cs delete mode 100644 Pilz.Updating.UpdateInstaller/Properties/Resources.resx delete mode 100644 Pilz.Updating.UpdateInstaller/Properties/Settings.Designer.cs delete mode 100644 Pilz.Updating.UpdateInstaller/Properties/Settings.settings delete mode 100644 Pilz.Updating.UpdateInstaller/Resources/icons8_checkmark_16px.png delete mode 100644 Pilz.Updating.UpdateInstaller/Resources/icons8_console_16px_1.png delete mode 100644 Pilz.Updating.UpdateInstaller/Resources/icons8_copy_16px.png delete mode 100644 Pilz.Updating.UpdateInstaller/Resources/icons8_installing_updates_12px.png delete mode 100644 Pilz.Updating.UpdateInstaller/Resources/icons8_installing_updates_16px.png delete mode 100644 Pilz.Updating.UpdateInstaller/Resources/icons8_installing_updates_32px.png delete mode 100644 Pilz.Updating.UpdateInstaller/Resources/icons8_installing_updates_48px.png delete mode 100644 Pilz.Updating.UpdateInstaller/Resources/icons8_open_archive_16px.png delete mode 100644 Pilz.Updating.UpdateInstaller/Resources/icons8_recycle_bin_16px.png delete mode 100644 Pilz.Updating.UpdateInstaller/Resources/icons8_sand_timer_16px.png delete mode 100644 Pilz.Updating.UpdateInstaller/Resources/icons8_uninstalling_updates_12px.png delete mode 100644 Pilz.Updating.UpdateInstaller/Resources/icons8_uninstalling_updates_16px.png delete mode 100644 Pilz.Updating.UpdateInstaller/Resources/icons8_uninstalling_updates_32px.png delete mode 100644 Pilz.Updating.UpdateInstaller/Resources/icons8_uninstalling_updates_48px.png delete mode 100644 Pilz.Updating.UpdateInstaller/icons8_software_installer.ico create mode 100644 Pilz.Updating/AppVersion.cs delete mode 100644 Pilz.Updating/ApplicationVersion.cs create mode 100644 Pilz.Updating/Json/AppVersionStringJsonConverter.cs delete mode 100644 Pilz.Updating/UpdateInstaller/UpdateInstallerConfig.cs diff --git a/Pilz.Updating.Client.GUI/Pilz.Updating.Client.GUI.csproj b/Pilz.Updating.Client.GUI/Pilz.Updating.Client.GUI.csproj index 810e57f..13354f3 100644 --- a/Pilz.Updating.Client.GUI/Pilz.Updating.Client.GUI.csproj +++ b/Pilz.Updating.Client.GUI/Pilz.Updating.Client.GUI.csproj @@ -11,10 +11,14 @@ - + True True - LangRes.resx + GeneralLangRes.resx + + + + Form SimpleActionDialog.cs @@ -22,12 +26,22 @@ Form + + UpdateInstallerLangRes.de.resx + True + True + + + UpdateInstallerLangRes.resx + True + True + UpdatesAvailableDialog.cs Form - + True True UpdatingClientGuiLangRes.resx @@ -35,9 +49,9 @@ - + ResXFileCodeGenerator - LangRes.Designer.cs + GeneralLangRes.Designer.cs SimpleActionDialog.cs @@ -45,17 +59,27 @@ SimpleActionDialog.cs + + Pilz.Updating.UpdateInstaller.My.Resources + UpdateInstallerLangRes.de.Designer.cs + ResXFileCodeGenerator + + + Pilz.Updating.UpdateInstaller.My.Resources + UpdateInstallerLangRes.Designer.cs + ResXFileCodeGenerator + UpdatesAvailableDialog.cs UpdatesAvailableDialog.cs - + Pilz.Updating.Client.GUI - + Pilz.Updating.Client.GUI ResXFileCodeGenerator UpdatingClientGuiLangRes.Designer.cs @@ -65,7 +89,6 @@ - diff --git a/Pilz.Updating.Client.GUI/SimpleActionDialog.Designer.cs b/Pilz.Updating.Client.GUI/SimpleActionDialog.Designer.cs index 0fb3156..3f7193a 100644 --- a/Pilz.Updating.Client.GUI/SimpleActionDialog.Designer.cs +++ b/Pilz.Updating.Client.GUI/SimpleActionDialog.Designer.cs @@ -1,7 +1,7 @@ using System.Diagnostics; using System.Runtime.CompilerServices; -namespace Pilz.Updating.Client.GUI +namespace Pilz.Updating.Client.Gui { [Microsoft.VisualBasic.CompilerServices.DesignerGenerated()] public partial class SimpleActionDialog : Telerik.WinControls.UI.RadForm diff --git a/Pilz.Updating.Client.GUI/SimpleActionDialog.cs b/Pilz.Updating.Client.GUI/SimpleActionDialog.cs index 8a7e964..1fd7592 100644 --- a/Pilz.Updating.Client.GUI/SimpleActionDialog.cs +++ b/Pilz.Updating.Client.GUI/SimpleActionDialog.cs @@ -1,4 +1,4 @@ -namespace Pilz.Updating.Client.GUI; +namespace Pilz.Updating.Client.Gui; public partial class SimpleActionDialog { diff --git a/Pilz.Updating.Client.GUI/UpdateClientGUI.cs b/Pilz.Updating.Client.GUI/UpdateClientGUI.cs index 6909c45..156074c 100644 --- a/Pilz.Updating.Client.GUI/UpdateClientGUI.cs +++ b/Pilz.Updating.Client.GUI/UpdateClientGUI.cs @@ -1,18 +1,19 @@ -using Microsoft.VisualBasic.CompilerServices; -using Pilz.UI; +using Pilz.UI; using Pilz.UI.Telerik.Dialogs; +using Pilz.Updating.Client.Gui.LangRes; +using Pilz.Updating.Client.GUI; using Pilz.Updating.GUIBase; using System.ComponentModel; using Telerik.WinControls; -namespace Pilz.Updating.Client.GUI; +namespace Pilz.Updating.Client.Gui; -public class UpdateClientGUI +public class UpdateClientGui { // F i e l d s private Form parentForm; - private SimpleActionDialog curProgressDialog; + private UpdateWindow curProgressDialog; private readonly UpdateClient updateClient; // P r o p e r t i e s @@ -23,23 +24,15 @@ public class UpdateClientGUI // C o n s t r u c t o r s - public UpdateClientGUI(UpdateClient updateClient) + public UpdateClientGui(UpdateClient updateClient) { this.updateClient = updateClient; - updateClient.UpdateStatusChanged += MyUpdateClient_UpdateStatusChanged; - updateClient.DownloadingUpdate += MyUpdateClient_DownloadingUpdate; - updateClient.InstallingUpdate += MyUpdateClient_InstallingUpdate; - updateClient.UpdateInstallerStarted += MyUpdateClient_FinishWork; - updateClient.NoUpdatesFound += MyUpdateClient_NoUpdatesFound; + updateClient.OnStatusChanged += UpdateClient_OnStatusChanged; } - ~UpdateClientGUI() + ~UpdateClientGui() { - updateClient.UpdateStatusChanged -= MyUpdateClient_UpdateStatusChanged; - updateClient.DownloadingUpdate -= MyUpdateClient_DownloadingUpdate; - updateClient.InstallingUpdate -= MyUpdateClient_InstallingUpdate; - updateClient.UpdateInstallerStarted -= MyUpdateClient_FinishWork; - updateClient.NoUpdatesFound -= MyUpdateClient_NoUpdatesFound; + updateClient.OnStatusChanged -= UpdateClient_OnStatusChanged; } // F e a t u r e s @@ -52,33 +45,81 @@ public class UpdateClientGUI private void EndUpdating() { - curProgressDialog?.Invoke(new Action(() => curProgressDialog.Close())); + curProgressDialog?.Invoke(curProgressDialog.Close); } - private void MyUpdateClient_UpdateStatusChanged(UpdateStatus newStatus) + // E v e n t s + + private void UpdateClient_OnStatusChanged(object sender, UpdateStatusEventArgs e) { - bool useGui = false; - if (!(newStatus == UpdateStatus.Searching && UseHiddenSearch)) + void setStatus() + { + if (e.Event == UpdateStatusEvent.PreEvent) + SetStatus(e.Status); + } + + switch (e.Status) + { + case UpdateStatus.Downloading: + setStatus(); + if (e.Event == UpdateStatusEvent.PostEvent) + { + if (e.Client.UpdatePackageInfo == null && !UseHiddenSearch) + RadMessageBox.Show(UpdatingClientGuiLangRes.MsgBox_NoUpdatesFound, UpdatingClientGuiLangRes.MsgBox_NoUpdatesFound_Titel, MessageBoxButtons.OK, RadMessageIcon.Info); + + if (e.Client.UpdatePackageInfo != null && !ShowUpdatesAvailable(e.Client.UpdatePackageInfo)) + e.Cancel = true; + } + break; + } + + switch (e.Status) + { + case UpdateStatus.Downloading: + case UpdateStatus.Extracting: + case UpdateStatus.Copying: + case UpdateStatus.Cleanup: + case UpdateStatus.Waiting: + setStatus(); + break; + } + + switch (e.Status) + { + case UpdateStatus.Done: + case UpdateStatus.Failed: + case UpdateStatus.Canceled: + EndUpdating(); + break; + } + } + + private void SetStatus(UpdateStatus status) + { + var useGui = false; + + if (!(status == UpdateStatus.Searching && UseHiddenSearch)) { useGui = true; } if (useGui && curProgressDialog is null) { - parentForm.Invoke(new Action(() => + parentForm.Invoke(() => { - curProgressDialog = new SimpleActionDialog(); - curProgressDialog.SetCurrentState(UpdateStatus.Waiting); + curProgressDialog = new UpdateWindow(); + curProgressDialog.SetStatus(UpdateStatus.Waiting); curProgressDialog.Show(parentForm); - })); + }); } - curProgressDialog?.Invoke(new Action(() => curProgressDialog.SetCurrentState(newStatus))); + curProgressDialog?.Invoke(() => curProgressDialog.SetStatus(status)); } - private void MyUpdateClient_DownloadingUpdate(UpdatePackageInfo pkg, CancelEventArgs e) + private bool ShowUpdatesAvailable(UpdatePackageInfo pkg) { var dres = default(DialogResult); + bool cancel; // Hide progress dialog curProgressDialog?.Invoke(new Action(curProgressDialog.Hide)); @@ -97,38 +138,22 @@ public class UpdateClientGUI pkg.Notes, updateClient.InstallAsAdmin); var symbol = GlobalSymbolFactory.Instance.GetImage(GlobalSymbols.software_installer, UI.Telerik.SvgImageSize.Small).ToIcon(); - dres = RadDialogBase.ShowDialog(dialog, parentForm, LangRes.Title_UpdatesAvailable, symbol).Result; + dres = RadDialogBase.ShowDialog(dialog, parentForm, GeneralLangRes.Title_UpdatesAvailable, symbol).Result; }); if (dres != DialogResult.OK) { - // Finish updating - e.Cancel = true; + // Cancel + cancel = true; EndUpdating(); } else { - // Cancel - e.Cancel = false; + // Continue + cancel = false; curProgressDialog?.Invoke(new Action(curProgressDialog.Show)); } - } - private void MyUpdateClient_InstallingUpdate(UpdatePackageInfo pkg, CancelEventArgs e) - { - e.Cancel = false; - } - - private void MyUpdateClient_FinishWork() - { - EndUpdating(); - } - - private void MyUpdateClient_NoUpdatesFound() - { - EndUpdating(); - - if (!UseHiddenSearch) - RadMessageBox.Show(UpdatingClientGuiLangRes.MsgBox_NoUpdatesFound, UpdatingClientGuiLangRes.MsgBox_NoUpdatesFound_Titel, MessageBoxButtons.OK, RadMessageIcon.Info); + return cancel; } } \ No newline at end of file diff --git a/Pilz.Updating.Client.GUI/LangRes.Designer.cs b/Pilz.Updating.Client.Gui/LangRes/GeneralLangRes.Designer.cs similarity index 95% rename from Pilz.Updating.Client.GUI/LangRes.Designer.cs rename to Pilz.Updating.Client.Gui/LangRes/GeneralLangRes.Designer.cs index 2034eed..7a3ea43 100644 --- a/Pilz.Updating.Client.GUI/LangRes.Designer.cs +++ b/Pilz.Updating.Client.Gui/LangRes/GeneralLangRes.Designer.cs @@ -8,7 +8,7 @@ // //------------------------------------------------------------------------------ -namespace Pilz.Updating.Client.GUI { +namespace Pilz.Updating.Client.Gui.LangRes { using System; @@ -22,14 +22,14 @@ namespace Pilz.Updating.Client.GUI { [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "17.0.0.0")] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - internal class LangRes { + internal class GeneralLangRes { private static global::System.Resources.ResourceManager resourceMan; private static global::System.Globalization.CultureInfo resourceCulture; [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] - internal LangRes() { + internal GeneralLangRes() { } /// @@ -39,7 +39,7 @@ namespace Pilz.Updating.Client.GUI { internal static global::System.Resources.ResourceManager ResourceManager { get { if (object.ReferenceEquals(resourceMan, null)) { - global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Pilz.Updating.Client.GUI.LangRes", typeof(LangRes).Assembly); + global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Pilz.Updating.Client.Gui.LangRes.GeneralLangRes", typeof(GeneralLangRes).Assembly); resourceMan = temp; } return resourceMan; diff --git a/Pilz.Updating.Client.GUI/LangRes.resx b/Pilz.Updating.Client.Gui/LangRes/GeneralLangRes.resx similarity index 100% rename from Pilz.Updating.Client.GUI/LangRes.resx rename to Pilz.Updating.Client.Gui/LangRes/GeneralLangRes.resx diff --git a/Pilz.Updating.UpdateInstaller/UpdateInstallerGuiLangRes.Designer.cs b/Pilz.Updating.Client.Gui/LangRes/UpdateInstallerLangRes.Designer.cs similarity index 96% rename from Pilz.Updating.UpdateInstaller/UpdateInstallerGuiLangRes.Designer.cs rename to Pilz.Updating.Client.Gui/LangRes/UpdateInstallerLangRes.Designer.cs index 97ccb12..d93dfe4 100644 --- a/Pilz.Updating.UpdateInstaller/UpdateInstallerGuiLangRes.Designer.cs +++ b/Pilz.Updating.Client.Gui/LangRes/UpdateInstallerLangRes.Designer.cs @@ -22,14 +22,14 @@ namespace Pilz.Updating.UpdateInstaller.My.Resources { [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "17.0.0.0")] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - internal class UpdateInstallerGuiLangRes { + internal class UpdateInstallerLangRes { private static global::System.Resources.ResourceManager resourceMan; private static global::System.Globalization.CultureInfo resourceCulture; [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] - internal UpdateInstallerGuiLangRes() { + internal UpdateInstallerLangRes() { } /// @@ -39,7 +39,7 @@ namespace Pilz.Updating.UpdateInstaller.My.Resources { internal static global::System.Resources.ResourceManager ResourceManager { get { if (object.ReferenceEquals(resourceMan, null)) { - global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Pilz.Updating.UpdateInstaller.UpdateInstallerGuiLangRes", typeof(UpdateInstallerGuiLangRes).Assembly); + global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Pilz.Updating.Client.Gui.LangRes.UpdateInstallerLangRes", typeof(UpdateInstallerLangRes).Assembly); resourceMan = temp; } return resourceMan; diff --git a/Pilz.Updating.UpdateInstaller/UpdateInstallerGuiLangRes.de.Designer.cs b/Pilz.Updating.Client.Gui/LangRes/UpdateInstallerLangRes.de.Designer.cs similarity index 100% rename from Pilz.Updating.UpdateInstaller/UpdateInstallerGuiLangRes.de.Designer.cs rename to Pilz.Updating.Client.Gui/LangRes/UpdateInstallerLangRes.de.Designer.cs diff --git a/Pilz.Updating.UpdateInstaller/UpdateInstallerGuiLangRes.de.resx b/Pilz.Updating.Client.Gui/LangRes/UpdateInstallerLangRes.de.resx similarity index 100% rename from Pilz.Updating.UpdateInstaller/UpdateInstallerGuiLangRes.de.resx rename to Pilz.Updating.Client.Gui/LangRes/UpdateInstallerLangRes.de.resx diff --git a/Pilz.Updating.UpdateInstaller/UpdateInstallerGuiLangRes.resx b/Pilz.Updating.Client.Gui/LangRes/UpdateInstallerLangRes.resx similarity index 100% rename from Pilz.Updating.UpdateInstaller/UpdateInstallerGuiLangRes.resx rename to Pilz.Updating.Client.Gui/LangRes/UpdateInstallerLangRes.resx diff --git a/Pilz.Updating.Client.GUI/UpdatingClientGuiLangRes.Designer.cs b/Pilz.Updating.Client.Gui/LangRes/UpdatingClientGuiLangRes.Designer.cs similarity index 98% rename from Pilz.Updating.Client.GUI/UpdatingClientGuiLangRes.Designer.cs rename to Pilz.Updating.Client.Gui/LangRes/UpdatingClientGuiLangRes.Designer.cs index ca2e014..9e58932 100644 --- a/Pilz.Updating.Client.GUI/UpdatingClientGuiLangRes.Designer.cs +++ b/Pilz.Updating.Client.Gui/LangRes/UpdatingClientGuiLangRes.Designer.cs @@ -39,7 +39,7 @@ namespace Pilz.Updating.Client.GUI { internal static global::System.Resources.ResourceManager ResourceManager { get { if (object.ReferenceEquals(resourceMan, null)) { - global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Pilz.Updating.Client.GUI.UpdatingClientGuiLangRes", typeof(UpdatingClientGuiLangRes).Assembly); + global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Pilz.Updating.Client.Gui.LangRes.UpdatingClientGuiLangRes", typeof(UpdatingClientGuiLangRes).Assembly); resourceMan = temp; } return resourceMan; diff --git a/Pilz.Updating.Client.GUI/UpdatingClientGuiLangRes.de.resx b/Pilz.Updating.Client.Gui/LangRes/UpdatingClientGuiLangRes.de.resx similarity index 100% rename from Pilz.Updating.Client.GUI/UpdatingClientGuiLangRes.de.resx rename to Pilz.Updating.Client.Gui/LangRes/UpdatingClientGuiLangRes.de.resx diff --git a/Pilz.Updating.Client.GUI/UpdatingClientGuiLangRes.resx b/Pilz.Updating.Client.Gui/LangRes/UpdatingClientGuiLangRes.resx similarity index 100% rename from Pilz.Updating.Client.GUI/UpdatingClientGuiLangRes.resx rename to Pilz.Updating.Client.Gui/LangRes/UpdatingClientGuiLangRes.resx diff --git a/Pilz.Updating.UpdateInstaller/Pilz.Updating.UpdateInstaller.csproj b/Pilz.Updating.Client.Gui/Pilz - Backup.Updating.Client.GUI.csproj similarity index 52% rename from Pilz.Updating.UpdateInstaller/Pilz.Updating.UpdateInstaller.csproj rename to Pilz.Updating.Client.Gui/Pilz - Backup.Updating.Client.GUI.csproj index 42531c6..0e36402 100644 --- a/Pilz.Updating.UpdateInstaller/Pilz.Updating.UpdateInstaller.csproj +++ b/Pilz.Updating.Client.Gui/Pilz - Backup.Updating.Client.GUI.csproj @@ -1,108 +1,119 @@  - WinExe net8.0-windows true enable - false - + 3.0.0 - - - Main.cs + + True + True + LangRes.resx + + Form - - True - True - MyIcons.resx + + Form - - True - True - Resources.resx + + SimpleActionDialog.cs - - True - Settings.settings - True + + Form UpdateInstallerGuiLangRes.de.resx - True True + True + UpdateInstallerGuiLangRes.resx + True + True + + + + UpdatesAvailableDialog.cs + Form + + True True - UpdateInstallerGuiLangRes.resx + UpdatingClientGuiLangRes.resx + + ResXFileCodeGenerator + LangRes.Designer.cs + Main.cs - - ResXFileCodeGenerator - MyIcons.Designer.cs + + SimpleActionDialog.cs - - ResXFileCodeGenerator - Resources.Designer.cs - Pilz.Updating.UpdateInstaller.My.Resources - Designer + + SimpleActionDialog.cs - ResXFileCodeGenerator - UpdateInstallerGuiLangRes.de.Designer.cs Pilz.Updating.UpdateInstaller.My.Resources + UpdateInstallerGuiLangRes.de.Designer.cs + ResXFileCodeGenerator Pilz.Updating.UpdateInstaller.My.Resources - ResXFileCodeGenerator UpdateInstallerGuiLangRes.Designer.cs + ResXFileCodeGenerator + + + UpdatesAvailableDialog.cs + + + UpdatesAvailableDialog.cs + + + + Pilz.Updating.Client.GUI + + + Pilz.Updating.Client.GUI + ResXFileCodeGenerator + UpdatingClientGuiLangRes.Designer.cs - - SettingsSingleFileGenerator - Pilz.Updating.UpdateInstaller.My - Settings.Designer.cs - - - - - - - - - + + - + - - + + - - - - + + + + + - + + @@ -113,7 +124,6 @@ - - + \ No newline at end of file diff --git a/Pilz.Updating.UpdateInstaller/Main.Designer.cs b/Pilz.Updating.Client.Gui/UpdateWindow.Designer.cs similarity index 81% rename from Pilz.Updating.UpdateInstaller/Main.Designer.cs rename to Pilz.Updating.Client.Gui/UpdateWindow.Designer.cs index 2f6b2c1..3a9f0e2 100644 --- a/Pilz.Updating.UpdateInstaller/Main.Designer.cs +++ b/Pilz.Updating.Client.Gui/UpdateWindow.Designer.cs @@ -1,11 +1,10 @@ using Microsoft.VisualBasic.CompilerServices; using System.Diagnostics; -using System.Runtime.CompilerServices; -namespace Pilz.Updating.UpdateInstaller +namespace Pilz.Updating.Client.Gui { [DesignerGenerated()] - public partial class Main : Telerik.WinControls.UI.RadForm + public partial class UpdateWindow { // Das Formular überschreibt den Löschvorgang, um die Komponentenliste zu bereinigen. @@ -34,13 +33,13 @@ namespace Pilz.Updating.UpdateInstaller [DebuggerStepThrough()] private void InitializeComponent() { - System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(Main)); - _Panel1 = new Panel(); + System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(UpdateWindow)); + panel1 = new Panel(); radWaitingBar1 = new Telerik.WinControls.UI.RadWaitingBar(); dotsLineWaitingBarIndicatorElement1 = new Telerik.WinControls.UI.DotsLineWaitingBarIndicatorElement(); radLabel_Status = new Telerik.WinControls.UI.RadLabel(); radLabel_Header = new Telerik.WinControls.UI.RadLabel(); - _Panel1.SuspendLayout(); + panel1.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)radWaitingBar1).BeginInit(); ((System.ComponentModel.ISupportInitialize)radLabel_Status).BeginInit(); ((System.ComponentModel.ISupportInitialize)radLabel_Header).BeginInit(); @@ -49,15 +48,15 @@ namespace Pilz.Updating.UpdateInstaller // // _Panel1 // - _Panel1.BackColor = Color.Transparent; - _Panel1.Controls.Add(radWaitingBar1); - _Panel1.Controls.Add(radLabel_Status); - _Panel1.Controls.Add(radLabel_Header); - _Panel1.Dock = DockStyle.Fill; - _Panel1.Location = new Point(0, 0); - _Panel1.Name = "_Panel1"; - _Panel1.Size = new Size(692, 87); - _Panel1.TabIndex = 1; + panel1.BackColor = Color.Transparent; + panel1.Controls.Add(radWaitingBar1); + panel1.Controls.Add(radLabel_Status); + panel1.Controls.Add(radLabel_Header); + panel1.Dock = DockStyle.Fill; + panel1.Location = new Point(0, 0); + panel1.Name = "_Panel1"; + panel1.Size = new Size(692, 87); + panel1.TabIndex = 1; // // radWaitingBar1 // @@ -94,7 +93,6 @@ namespace Pilz.Updating.UpdateInstaller // radLabel_Header.Anchor = AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right; radLabel_Header.AutoSize = false; - radLabel_Header.Image = MyIcons.icons8_installing_updates_48px; radLabel_Header.Location = new Point(3, 3); radLabel_Header.Name = "radLabel_Header"; radLabel_Header.Size = new Size(686, 57); @@ -109,7 +107,7 @@ namespace Pilz.Updating.UpdateInstaller AutoScaleDimensions = new SizeF(7F, 15F); AutoScaleMode = AutoScaleMode.Font; ClientSize = new Size(692, 87); - Controls.Add(_Panel1); + Controls.Add(panel1); FormBorderStyle = FormBorderStyle.FixedSingle; Icon = (Icon)resources.GetObject("$this.Icon"); MaximizeBox = false; @@ -117,7 +115,7 @@ namespace Pilz.Updating.UpdateInstaller Name = "Main"; StartPosition = FormStartPosition.CenterScreen; Text = "Installing"; - _Panel1.ResumeLayout(false); + panel1.ResumeLayout(false); ((System.ComponentModel.ISupportInitialize)radWaitingBar1).EndInit(); ((System.ComponentModel.ISupportInitialize)radLabel_Status).EndInit(); ((System.ComponentModel.ISupportInitialize)radLabel_Header).EndInit(); @@ -125,32 +123,10 @@ namespace Pilz.Updating.UpdateInstaller ResumeLayout(false); } - private Panel _Panel1; + private Panel panel1; private Telerik.WinControls.UI.RadLabel radLabel_Status; private Telerik.WinControls.UI.RadLabel radLabel_Header; private Telerik.WinControls.UI.RadWaitingBar radWaitingBar1; private Telerik.WinControls.UI.DotsLineWaitingBarIndicatorElement dotsLineWaitingBarIndicatorElement1; - - internal Panel Panel1 - { - [MethodImpl(MethodImplOptions.Synchronized)] - get - { - return _Panel1; - } - - [MethodImpl(MethodImplOptions.Synchronized)] - set - { - if (_Panel1 != null) - { - } - - _Panel1 = value; - if (_Panel1 != null) - { - } - } - } } } \ No newline at end of file diff --git a/Pilz.Updating.Client.Gui/UpdateWindow.cs b/Pilz.Updating.Client.Gui/UpdateWindow.cs new file mode 100644 index 0000000..9b6af9d --- /dev/null +++ b/Pilz.Updating.Client.Gui/UpdateWindow.cs @@ -0,0 +1,115 @@ +namespace Pilz.Updating.Client.Gui; + +public partial class UpdateWindow : Telerik.WinControls.UI.RadForm +{ + // C o n s t r u c t o r s + + public UpdateWindow() + { + // Init Form + InitializeComponent(); + + // Events + Shown += Main_Shown; + FormClosed += Main_FormClosed; + FormClosing += Main_FormClosing; + + // Init Application Header Text + string header; + if (!string.IsNullOrEmpty(installer.Configuration.ApplicationName)) + header = string.Format(My.Resources.UpdateInstallerGuiLangRes.String_UpdatingApplicationX, installer.Configuration.ApplicationName); + else + header = My.Resources.UpdateInstallerGuiLangRes.String_UpdateIsRunning; + + radLabel_Header.Text = $"{header}"; + } + + // F i e l d s + + private bool allowClose = false; + + // F e a t u r e s + + public void SetStatus(UpdateStatus status) + { + string newStatusText = string.Empty; + Image newStatusImage = null; + + switch (status) + { + case UpdateStatus.Copying: + newStatusText = My.Resources.UpdateInstallerGuiLangRes.Status_CopyingFiles; + break; + case UpdateStatus.Done: + newStatusText = My.Resources.UpdateInstallerGuiLangRes.Status_Done; + break; + case UpdateStatus.Extracting: + newStatusText = My.Resources.UpdateInstallerGuiLangRes.Status_Extracting; + break; + case UpdateStatus.Cleanup: + newStatusText = My.Resources.UpdateInstallerGuiLangRes.Status_RemovingFiles; + break; + case UpdateStatus.Waiting: + newStatusText = My.Resources.UpdateInstallerGuiLangRes.Status_Waiting; + break; + } + + switch (status) + { + case UpdateStatus.Copying: + newStatusImage = MyIcons.icons8_copy_16px; + break; + case UpdateStatus.Extracting: + newStatusImage = MyIcons.icons8_open_archive_16px; + break; + case UpdateStatus.Cleanup: + newStatusImage = MyIcons.icons8_recycle_bin_16px; + break; + case UpdateStatus.Waiting: + newStatusImage = MyIcons.icons8_sand_timer_16px; + break; + case UpdateStatus.Done: + newStatusImage = MyIcons.icons8_checkmark_16px; + break; + } + + radLabel_Status.Text = newStatusText; + radLabel_Status.Image = newStatusImage; + } + + private async Task WaitforHostApp() + { + SetStatus(UpdateStatus.Waiting); + await Task.Run(installer.WaitForHostApplication); + } + + private async void ExecuteUpdate() + { + await Task.Run(installer.InstallUpdate); + allowClose = true; + Close(); + } + + private async void Main_Shown(object sender, EventArgs e) + { + radWaitingBar1.StartWaiting(); + await WaitforHostApp(); + ExecuteUpdate(); + } + + private void Main_FormClosed(object sender, FormClosedEventArgs e) + { + installer.StartHostApplication(); + } + + private void Main_FormClosing(object sender, FormClosingEventArgs e) + { + radWaitingBar1.StopWaiting(); + e.Cancel = !allowClose; + } + + private void Installer_StatusChanges(object sender, UpdateClientStatusChangedEventArgs e) + { + Invoke(new Action(() => SetStatus(e.NewStatus))); + } +} \ No newline at end of file diff --git a/Pilz.Updating.UpdateInstaller/Main.resx b/Pilz.Updating.Client.Gui/UpdateWindow.resx similarity index 100% rename from Pilz.Updating.UpdateInstaller/Main.resx rename to Pilz.Updating.Client.Gui/UpdateWindow.resx diff --git a/Pilz.Updating.Client/Delegates.cs b/Pilz.Updating.Client/Delegates.cs new file mode 100644 index 0000000..4d16947 --- /dev/null +++ b/Pilz.Updating.Client/Delegates.cs @@ -0,0 +1,4 @@ +namespace Pilz.Updating.Client; + +public delegate void UpdateClientEventHandler(object sender, UpdateClientEventArgs e); +public delegate void UpdateClientStatusChangedEventHandler(object sender, UpdateStatusEventArgs e); diff --git a/Pilz.Updating.Client/General.cs b/Pilz.Updating.Client/General.cs new file mode 100644 index 0000000..6139efe --- /dev/null +++ b/Pilz.Updating.Client/General.cs @@ -0,0 +1,46 @@ +namespace Pilz.Updating.Client; + +internal static class General +{ + public static void CopyFiles(DirectoryInfo sourceDir, DirectoryInfo destinationDir) + { + if (!destinationDir.Exists) + destinationDir.Create(); + + foreach (FileInfo sFile in sourceDir.EnumerateFiles("*", SearchOption.TopDirectoryOnly)) + { + var dFile = new FileInfo(Path.Combine(destinationDir.FullName, sFile.Name)); + var triesLeft = 1; + + while (triesLeft > 0) + { + triesLeft--; + + try + { + sFile.CopyTo(dFile.FullName, true); + } + catch (IOException) + { + if (triesLeft == 0 && File.Exists(dFile.FullName)) + { + var oldFile = dFile.FullName + ".old"; + File.Delete(oldFile); + File.Move(dFile.FullName, oldFile, true); + File.Delete(oldFile); + triesLeft++; + } + } + catch (Exception) + { + } + } + } + + foreach (DirectoryInfo sDir in sourceDir.EnumerateDirectories("*", SearchOption.TopDirectoryOnly)) + { + var dDir = destinationDir.CreateSubdirectory(sDir.Name); + CopyFiles(sDir, dDir); + } + } +} diff --git a/Pilz.Updating.Client/UpdateClient.cs b/Pilz.Updating.Client/UpdateClient.cs index 4a52e8f..c769b21 100644 --- a/Pilz.Updating.Client/UpdateClient.cs +++ b/Pilz.Updating.Client/UpdateClient.cs @@ -1,97 +1,72 @@ -using Pilz.Updating.UpdateInstaller; -using System.ComponentModel; +using System.ComponentModel; +using System.Configuration; using System.Diagnostics; using System.IO.Compression; +using System.Runtime.CompilerServices; +using System.Security.Principal; +using Z.IO.Extensions; -namespace Pilz.Updating; +namespace Pilz.Updating.Client; -public class UpdateClient(string updateUrl, ApplicationVersion currentVersion, Channels minimumChannel) +public class UpdateClient(string updateUrl, AppVersion currentVersion, Channels minimumChannel) { + // E v e n t s - // E b v e n t s - - public event UpdateStatusChangedEventHandler UpdateStatusChanged; - - public delegate void UpdateStatusChangedEventHandler(UpdateStatus newStatus); - - public event DownloadingUpdateEventHandler DownloadingUpdate; - - public delegate void DownloadingUpdateEventHandler(UpdatePackageInfo pkg, CancelEventArgs e); - - public event InstallingUpdateEventHandler InstallingUpdate; - - public delegate void InstallingUpdateEventHandler(UpdatePackageInfo pkg, CancelEventArgs e); - - public event UpdateInstallerStartedEventHandler UpdateInstallerStarted; - - public delegate void UpdateInstallerStartedEventHandler(); - - public event NoUpdatesFoundEventHandler NoUpdatesFound; - - public delegate void NoUpdatesFoundEventHandler(); + public event UpdateClientStatusChangedEventHandler OnStatusChanged; // F i e l d s private readonly Dictionary dicPackagePaths = []; - private UpdateStatus curDownloadingStatus = UpdateStatus.Waiting; // P r o p e r t i e s public HttpClient WebClient { get; private set; } = new(); public string UpdateUrl { get; private set; } = updateUrl; - public ApplicationVersion CurrentVersion { get; private set; } = currentVersion; + public AppVersion CurrentVersion { get; private set; } = currentVersion; public Channels MinimumChannel { get; private set; } = (Channels)Math.Max((int)minimumChannel, (int)currentVersion.Channel); public UpdateInfo UpdateInfo { get; private set; } = null; public UpdatePackageInfo UpdatePackageInfo { get; private set; } = null; public bool AutoCloseHostApplication { get; set; } = false; - public bool AutoRestartHostApplication { get; set; } = false; public string RestartHostApplicationArguments { get; set; } public string HostApplicationPath { get; set; } = string.Empty; public string ApplicationName { get; set; } = string.Empty; public bool InstallAsAdmin { get; set; } = false; - public uint MillisecondsToWaitForHostApplicationToClose { get; set; } = 10000; - public bool ForceClosingHostApplication { get; set; } = true; public bool UIDarkMode { get; set; } = false; + public bool HasUpdates => UpdatePackageInfo != null; // E v e n t M e t h o d s - private bool RaiseDownloadingUpdate(UpdatePackageInfo pkg) + private void RaiseStatusChanged(UpdateStatus status) { - var e = new CancelEventArgs(false); - DownloadingUpdate?.Invoke(pkg, e); - return e.Cancel; + RaiseStatusChanged(status, UpdateStatusEvent.Default); } - private bool RaiseInstallingUpdate(UpdatePackageInfo pkg) + private void RaiseStatusChanged(UpdateStatus status, UpdateStatusEvent statusEvent) { - var e = new CancelEventArgs(true); - InstallingUpdate?.Invoke(pkg, e); - return e.Cancel; + RaiseStatusChanged(status, statusEvent, false); } - // U p d a t e R o u t i n e s + private bool RaiseStatusChanged(UpdateStatus status, UpdateStatusEvent statusEvent, bool canCancel) + { + var args = new UpdateStatusEventArgs(this, status, statusEvent, canCancel); + OnStatusChanged?.Invoke(this, args); + return args.CanCancel && args.Cancel; + } + + // U p d a t e r o u t i n e s public async Task UpdateInteractive() { var latestVersion = await CheckForUpdate(); - if (latestVersion is null) - NoUpdatesFound?.Invoke(); - else + + if (HasUpdates) await UpdateInteractive(latestVersion); } public async Task UpdateInteractive(UpdatePackageInfo package) { - if (!RaiseDownloadingUpdate(package) && await DownloadPackageAsync(package)) - { - if (!RaiseInstallingUpdate(package)) - await InstallPackage(package); - } - } - - public void RaiseUpdateStatusChanged(UpdateStatus newStatus) - { - UpdateStatusChanged?.Invoke(newStatus); + if (await DownloadPackageAsync(package)) + await InstallPackageAsync(package); } // F e a t u r e s @@ -103,21 +78,23 @@ public class UpdateClient(string updateUrl, ApplicationVersion currentVersion, C return info; } - public async Task CheckForUpdate() + private async Task CheckForUpdate() { - RaiseUpdateStatusChanged(UpdateStatus.Searching); + RaiseStatusChanged(UpdateStatus.Searching, UpdateStatusEvent.PreEvent); + UpdateInfo = await GetUpdateInfo(); - if (UpdateInfo is not null) - return CheckForUpdate(UpdateInfo); - else + + if (UpdateInfo is null) return null; + + return CheckForUpdate(UpdateInfo); } - public UpdatePackageInfo CheckForUpdate(UpdateInfo updateInfo) + private UpdatePackageInfo CheckForUpdate(UpdateInfo updateInfo) { UpdatePackageInfo foundPkgInfo = null; var latestVersion = CurrentVersion; - RaiseUpdateStatusChanged(UpdateStatus.Searching); + foreach (UpdatePackageInfo pkgInfo in updateInfo.Packages) { if (pkgInfo.Version.Channel <= MinimumChannel && pkgInfo.Version > latestVersion) @@ -128,13 +105,20 @@ public class UpdateClient(string updateUrl, ApplicationVersion currentVersion, C } UpdatePackageInfo = foundPkgInfo; + + if (!RaiseStatusChanged(UpdateStatus.Searching, UpdateStatusEvent.PostEvent, true)) + { + UpdatePackageInfo = null; + return null; + } + return foundPkgInfo; } public async Task DownloadPackageAsync(UpdatePackageInfo package) { - curDownloadingStatus = UpdateStatus.DownloadingPackage; - RaiseUpdateStatusChanged(curDownloadingStatus); + RaiseStatusChanged(UpdateStatus.Downloading, UpdateStatusEvent.PreEvent); + var dirPath = Path.Combine(MyPaths.GetMyAppDataPath(), package.GetHashCode().ToString()); var zipPath = Path.Combine(dirPath, "package.zip"); var dir = new DirectoryInfo(dirPath); @@ -159,88 +143,57 @@ public class UpdateClient(string updateUrl, ApplicationVersion currentVersion, C return false; } + if (!RaiseStatusChanged(UpdateStatus.Downloading, UpdateStatusEvent.PostEvent, true)) + { + RaiseStatusChanged(UpdateStatus.Canceled); + return false; + } + return true; } - private async Task DownloadUpdateInstaller() + private void InstallPackage(UpdatePackageInfo package) { - curDownloadingStatus = UpdateStatus.DownloadingInstaller; - RaiseUpdateStatusChanged(curDownloadingStatus); - - // Ensure update installer path is empty - var installerDirPath = new DirectoryInfo(Path.Combine(MyPaths.GetMyAppDataPath(), "UpdateInstallerTool")); - if (installerDirPath.Exists) - installerDirPath.Delete(true); - - await Task.Delay(100); - installerDirPath.Create(); - await Task.Delay(100); - - // Download update installer zip - var installerZipPath = Path.Combine(installerDirPath.FullName, "UpdatenInstaller.zip"); - using (var installerZipFile = new FileStream(installerZipPath, FileMode.Create, FileAccess.ReadWrite)) + // Extract Package + if (!RaiseStatusChanged(UpdateStatus.Extracting, UpdateStatusEvent.PreEvent, true)) { - using var installerZipStream = await WebClient.GetStreamAsync(UpdateInfo.UpdateInstallerLink); - await installerZipStream.CopyToAsync(installerZipFile); + RaiseStatusChanged(UpdateStatus.Canceled); + return; } + if (!dicPackagePaths.TryGetValue(package, out var packagePath)) + { + RaiseStatusChanged(UpdateStatus.Failed); + return; + } + var dataPath = packagePath + ".extracted"; + var packagePathDir = new DirectoryInfo(packagePath); + if (packagePathDir.Exists) + { + packagePathDir.Delete(true); + Task.Delay(1000); + } + ZipFile.ExtractToDirectory(packagePath, dataPath); + RaiseStatusChanged(UpdateStatus.Extracting, UpdateStatusEvent.PostEvent); - // Extract update installer - var installerExtractPath = installerDirPath.CreateSubdirectory("extracted"); - ZipFile.ExtractToDirectory(installerZipPath, installerExtractPath.FullName); - File.Delete(installerZipPath); + // Install Package + RaiseStatusChanged(UpdateStatus.Copying, UpdateStatusEvent.PreEvent); + var dataPathDir = new DirectoryInfo(dataPath); + var destDir = new DirectoryInfo(HostApplicationPath); + General.CopyFiles(dataPathDir, destDir); + RaiseStatusChanged(UpdateStatus.Copying, UpdateStatusEvent.PostEvent); - // Get UpdateInstaller.exe file - return installerExtractPath.EnumerateFiles("*.exe").FirstOrDefault(); + // Delete Package + RaiseStatusChanged(UpdateStatus.Cleanup, UpdateStatusEvent.PreEvent); + File.Delete(packagePath); + Directory.Delete(dataPath, true); + RaiseStatusChanged(UpdateStatus.Cleanup, UpdateStatusEvent.PostEvent); + + // Finish + RaiseStatusChanged(UpdateStatus.Done, UpdateStatusEvent.Default); } - private void StartUpdateInstaller(string packagePath, string installerPath) + public Task InstallPackageAsync(UpdatePackageInfo package) { - RaiseUpdateStatusChanged(UpdateStatus.StartingInstaller); - - // Create update settings - var myAppPath = IO.Extensions.GetExecutablePath(); - var updateConfig = new UpdateInstallerConfig - { - PackagePath = packagePath, - RestartHostApplication = AutoRestartHostApplication, - RestartHostApplicationArguments = AutoRestartHostApplication ? RestartHostApplicationArguments : string.Empty, - ApplicationName = ApplicationName, - HostApplicationPath = string.IsNullOrEmpty(HostApplicationPath) ? Path.GetDirectoryName(myAppPath) : HostApplicationPath, - HostApplicationProcessPath = myAppPath, - MillisecondsToWaitForHostApplicationToClose = MillisecondsToWaitForHostApplicationToClose, - ForceClosingHostApplication = ForceClosingHostApplication, - UIDarkMode = UIDarkMode - }; - - // Start UpdateInstaller - var procStartInfo = new ProcessStartInfo - { - FileName = installerPath, - Arguments = updateConfig.ToString(), - UseShellExecute = false, - Verb = InstallAsAdmin ? "runas" : string.Empty - }; - Process.Start(procStartInfo); - UpdateInstallerStarted?.Invoke(); - } - - public async Task InstallPackage(UpdatePackageInfo package) - { - if (dicPackagePaths.TryGetValue(package, out var packagePath)) - { - // Download update installer - var installerPath = await DownloadUpdateInstaller(); - - // Start update installer - StartUpdateInstaller(packagePath, installerPath.FullName); - - // Close Host Application - if (AutoCloseHostApplication) - Environment.Exit(Environment.ExitCode); - - return true; - } - - return false; + return Task.Run(() => InstallPackage(package)); } } \ No newline at end of file diff --git a/Pilz.Updating.Client/UpdateClientEventArgs.cs b/Pilz.Updating.Client/UpdateClientEventArgs.cs new file mode 100644 index 0000000..007d3db --- /dev/null +++ b/Pilz.Updating.Client/UpdateClientEventArgs.cs @@ -0,0 +1,8 @@ +using Pilz.Updating.Client.Installer; + +namespace Pilz.Updating.Client; + +public class UpdateClientEventArgs(UpdateClient client) : EventArgs +{ + public UpdateClient Client { get; init; } = client; +} diff --git a/Pilz.Updating.Client/UpdateStatus.cs b/Pilz.Updating.Client/UpdateStatus.cs index ea1601b..83d592a 100644 --- a/Pilz.Updating.Client/UpdateStatus.cs +++ b/Pilz.Updating.Client/UpdateStatus.cs @@ -1,10 +1,14 @@ -namespace Pilz.Updating; +namespace Pilz.Updating.Client; public enum UpdateStatus { Waiting, Searching, - DownloadingPackage, - DownloadingInstaller, - StartingInstaller + Downloading, + Extracting, + Copying, + Cleanup, + Done, + Failed, + Canceled, } \ No newline at end of file diff --git a/Pilz.Updating.Client/UpdateStatusEvent.cs b/Pilz.Updating.Client/UpdateStatusEvent.cs new file mode 100644 index 0000000..1bbef44 --- /dev/null +++ b/Pilz.Updating.Client/UpdateStatusEvent.cs @@ -0,0 +1,8 @@ +namespace Pilz.Updating.Client; + +public enum UpdateStatusEvent +{ + Default, + PreEvent, + PostEvent +} diff --git a/Pilz.Updating.Client/UpdateStatusEventArgs.cs b/Pilz.Updating.Client/UpdateStatusEventArgs.cs new file mode 100644 index 0000000..b6b2120 --- /dev/null +++ b/Pilz.Updating.Client/UpdateStatusEventArgs.cs @@ -0,0 +1,11 @@ +using Pilz.Updating.Client.Installer; + +namespace Pilz.Updating.Client; + +public class UpdateStatusEventArgs(UpdateClient client, UpdateStatus status, UpdateStatusEvent state, bool canCancel) : UpdateClientEventArgs(client) +{ + public UpdateStatus Status { get; } = status; + public UpdateStatusEvent Event { get; } = state; + public bool CanCancel { get; } = canCancel; + public bool Cancel { get; set; } +} diff --git a/Pilz.Updating.Client/Utils.cs b/Pilz.Updating.Client/Utils.cs new file mode 100644 index 0000000..acbfdb8 --- /dev/null +++ b/Pilz.Updating.Client/Utils.cs @@ -0,0 +1,5 @@ +namespace Pilz.Updating.Client; + +public static class Utils +{ +} diff --git a/Pilz.Updating.UpdateInstaller.Lib/Pilz.Updating.UpdateInstaller.Lib.csproj b/Pilz.Updating.UpdateInstaller.Lib/Pilz.Updating.UpdateInstaller.Lib.csproj deleted file mode 100644 index 802f3a7..0000000 --- a/Pilz.Updating.UpdateInstaller.Lib/Pilz.Updating.UpdateInstaller.Lib.csproj +++ /dev/null @@ -1,18 +0,0 @@ - - - - net8.0-windows - enable - enable - - - - 3.0.0 - - - - - - - - diff --git a/Pilz.Updating.UpdateInstaller.Lib/UpdateInstaller.cs b/Pilz.Updating.UpdateInstaller.Lib/UpdateInstaller.cs deleted file mode 100644 index 1418341..0000000 --- a/Pilz.Updating.UpdateInstaller.Lib/UpdateInstaller.cs +++ /dev/null @@ -1,172 +0,0 @@ -using Microsoft.VisualBasic.CompilerServices; -using System.Diagnostics; -using System.IO.Compression; - -namespace Pilz.Updating.UpdateInstaller.Lib; - -public class UpdateInstaller(UpdateInstallerConfig config) -{ - // E v e n t s - - public delegate void UpdateInstallerEventHandler(object sender, UpdateInstallerEventArgs e); - public delegate void UpdateInstallerStepEventHandler(object sender, UpdateInstallerStepEventArgs e); - public delegate void StatusChangesEventHandler(object sender, UpdateInstallerStatusChangedEventArgs e); - - public event StatusChangesEventHandler? StatusChanges; - public event UpdateInstallerStepEventHandler? OnStep; - - // F i e l d s - - private string dataPath = string.Empty; - - // P r o p e r t i e s - - public UpdateInstallerConfig Configuration { get; private set; } = config; - - // F e a t u r e s - - private void ChangeStep(UpdateInstallerStep step, UpdateInstallerStepState state) - { - OnStep?.Invoke(this, new UpdateInstallerStepEventArgs(this, step, state)); - } - - private void ChangeStatus(UpdateInstallerStatus newStatus) - { - StatusChanges?.Invoke(this, new UpdateInstallerStatusChangedEventArgs(newStatus)); - } - - public void StartHostApplication() - { - if (!string.IsNullOrEmpty(Conversions.ToString(Configuration.RestartHostApplication)) && File.Exists(Configuration.HostApplicationProcessPath)) - Process.Start(Configuration.HostApplicationProcessPath, Configuration.RestartHostApplicationArguments); - } - - public void InstallUpdate() - { - ChangeStep(UpdateInstallerStep.Startup, UpdateInstallerStepState.Default); - - // Extract Package - ChangeStatus(UpdateInstallerStatus.Extracting); - ChangeStep(UpdateInstallerStep.ExtractPackage, UpdateInstallerStepState.PreEvent); - ExtractPackage(); - ChangeStep(UpdateInstallerStep.ExtractPackage, UpdateInstallerStepState.PostEvent); - - // Install Package - ChangeStatus(UpdateInstallerStatus.CopyingFiles); - ChangeStep(UpdateInstallerStep.CopyFiles, UpdateInstallerStepState.PreEvent); - CopyFiles(); - ChangeStep(UpdateInstallerStep.CopyFiles, UpdateInstallerStepState.PostEvent); - - // Delete Package - ChangeStatus(UpdateInstallerStatus.RemovingFiles); - ChangeStep(UpdateInstallerStep.DeletePackage, UpdateInstallerStepState.PreEvent); - DeletePackage(); - ChangeStep(UpdateInstallerStep.DeletePackage, UpdateInstallerStepState.PostEvent); - - // Finish - ChangeStatus(UpdateInstallerStatus.Done); - ChangeStep(UpdateInstallerStep.Finish, UpdateInstallerStepState.Default); - } - - public void WaitForHostApplication() - { - bool forcedKill = false; - bool enabled = true; - var stw = new Stopwatch(); - stw.Start(); - Process[] getProcesses() => Process.GetProcessesByName(Path.GetFileNameWithoutExtension(Configuration.HostApplicationProcessPath)); - while (enabled) - { - if (getProcesses().Any()) - { - if (stw.ElapsedMilliseconds >= Configuration.MillisecondsToWaitForHostApplicationToClose) - { - if (!forcedKill && Configuration.ForceClosingHostApplication) - { - foreach (Process p in getProcesses()) - p.Kill(); - stw.Reset(); - forcedKill = true; - } - else - { - stw.Stop(); - enabled = false; - } - } - } - else - enabled = false; - } - } - - private void ExtractPackage() - { - string packagePath = Configuration.PackagePath; - string zipPath = packagePath; - dataPath = Path.Combine(packagePath + ".extracted"); - var dataPathDir = new DirectoryInfo(dataPath); - - if (dataPathDir.Exists) - { - dataPathDir.Delete(true); - Task.Delay(100); - } - - ZipFile.ExtractToDirectory(zipPath, dataPath); - } - - private void CopyFiles() - { - var sourceDir = new DirectoryInfo(dataPath); - var destDir = new DirectoryInfo(Configuration.HostApplicationPath); - CopyFiles(sourceDir, destDir); - } - - private void CopyFiles(DirectoryInfo sourceDir, DirectoryInfo destinationDir) - { - if (!destinationDir.Exists) - destinationDir.Create(); - - foreach (FileInfo sFile in sourceDir.EnumerateFiles("*", SearchOption.TopDirectoryOnly)) - { - var dFile = new FileInfo(Path.Combine(destinationDir.FullName, sFile.Name)); - var triesLeft = 1; - - while (triesLeft > 0) - { - triesLeft--; - - try - { - sFile.CopyTo(dFile.FullName, true); - } - catch (IOException) - { - if (triesLeft == 0 && File.Exists(dFile.FullName)) - { - var oldFile = dFile.FullName + ".old"; - File.Delete(oldFile); - File.Move(dFile.FullName, oldFile, true); - File.Delete(oldFile); - triesLeft++; - } - } - catch (Exception) - { - } - } - } - - foreach (DirectoryInfo sDir in sourceDir.EnumerateDirectories("*", SearchOption.TopDirectoryOnly)) - { - var dDir = destinationDir.CreateSubdirectory(sDir.Name); - CopyFiles(sDir, dDir); - } - } - - private void DeletePackage() - { - Directory.Delete(Configuration.PackagePath, true); - } -} \ No newline at end of file diff --git a/Pilz.Updating.UpdateInstaller.Lib/UpdateInstallerEventArgs.cs b/Pilz.Updating.UpdateInstaller.Lib/UpdateInstallerEventArgs.cs deleted file mode 100644 index 1f90fd6..0000000 --- a/Pilz.Updating.UpdateInstaller.Lib/UpdateInstallerEventArgs.cs +++ /dev/null @@ -1,6 +0,0 @@ -namespace Pilz.Updating.UpdateInstaller.Lib; - -public class UpdateInstallerEventArgs(UpdateInstaller updateInstaller) : EventArgs -{ - public UpdateInstaller UpdateInstaller { get; init; } = updateInstaller; -} diff --git a/Pilz.Updating.UpdateInstaller.Lib/UpdateInstallerStatus.cs b/Pilz.Updating.UpdateInstaller.Lib/UpdateInstallerStatus.cs deleted file mode 100644 index 72217ae..0000000 --- a/Pilz.Updating.UpdateInstaller.Lib/UpdateInstallerStatus.cs +++ /dev/null @@ -1,11 +0,0 @@ - -namespace Pilz.Updating.UpdateInstaller.Lib; - -public enum UpdateInstallerStatus -{ - Waiting, - Extracting, - CopyingFiles, - RemovingFiles, - Done -} \ No newline at end of file diff --git a/Pilz.Updating.UpdateInstaller.Lib/UpdateInstallerStatusChangedEventArgs.cs b/Pilz.Updating.UpdateInstaller.Lib/UpdateInstallerStatusChangedEventArgs.cs deleted file mode 100644 index b037893..0000000 --- a/Pilz.Updating.UpdateInstaller.Lib/UpdateInstallerStatusChangedEventArgs.cs +++ /dev/null @@ -1,11 +0,0 @@ -namespace Pilz.Updating.UpdateInstaller.Lib; - -public class UpdateInstallerStatusChangedEventArgs : EventArgs -{ - public UpdateInstallerStatus NewStatus { get; private set; } - - public UpdateInstallerStatusChangedEventArgs(UpdateInstallerStatus newStatus) : base() - { - NewStatus = newStatus; - } -} \ No newline at end of file diff --git a/Pilz.Updating.UpdateInstaller.Lib/UpdateInstallerStep.cs b/Pilz.Updating.UpdateInstaller.Lib/UpdateInstallerStep.cs deleted file mode 100644 index 8ff2659..0000000 --- a/Pilz.Updating.UpdateInstaller.Lib/UpdateInstallerStep.cs +++ /dev/null @@ -1,10 +0,0 @@ -namespace Pilz.Updating.UpdateInstaller.Lib; - -public enum UpdateInstallerStep -{ - Startup, - ExtractPackage, - CopyFiles, - DeletePackage, - Finish -} diff --git a/Pilz.Updating.UpdateInstaller.Lib/UpdateInstallerStepEventArgs.cs b/Pilz.Updating.UpdateInstaller.Lib/UpdateInstallerStepEventArgs.cs deleted file mode 100644 index ae13184..0000000 --- a/Pilz.Updating.UpdateInstaller.Lib/UpdateInstallerStepEventArgs.cs +++ /dev/null @@ -1,13 +0,0 @@ -namespace Pilz.Updating.UpdateInstaller.Lib; - -public class UpdateInstallerStepEventArgs : UpdateInstallerEventArgs -{ - public UpdateInstallerStep Step { get; init; } - public UpdateInstallerStepState State { get; init; } - - public UpdateInstallerStepEventArgs(UpdateInstaller updateInstaller, UpdateInstallerStep step, UpdateInstallerStepState state) : base(updateInstaller) - { - Step = step; - State = state; - } -} diff --git a/Pilz.Updating.UpdateInstaller.Lib/UpdateInstallerStepState.cs b/Pilz.Updating.UpdateInstaller.Lib/UpdateInstallerStepState.cs deleted file mode 100644 index e5390bf..0000000 --- a/Pilz.Updating.UpdateInstaller.Lib/UpdateInstallerStepState.cs +++ /dev/null @@ -1,8 +0,0 @@ -namespace Pilz.Updating.UpdateInstaller.Lib; - -public enum UpdateInstallerStepState -{ - Default, - PreEvent, - PostEvent -} diff --git a/Pilz.Updating.UpdateInstaller/App.config b/Pilz.Updating.UpdateInstaller/App.config deleted file mode 100644 index 61c5262..0000000 --- a/Pilz.Updating.UpdateInstaller/App.config +++ /dev/null @@ -1,9 +0,0 @@ - - - - - - - - - \ No newline at end of file diff --git a/Pilz.Updating.UpdateInstaller/General.cs b/Pilz.Updating.UpdateInstaller/General.cs deleted file mode 100644 index adb1edf..0000000 --- a/Pilz.Updating.UpdateInstaller/General.cs +++ /dev/null @@ -1,32 +0,0 @@ -using Pilz.Plugins; - -namespace Pilz.Updating.UpdateInstaller; - -internal static class General -{ - private static string p = null; - - public static string MyAppPath - { - get - { - if (string.IsNullOrEmpty(p)) - p = Path.GetDirectoryName(IO.Extensions.GetExecutablePath()); - return p; - } - } - - public static void LoadAddons(Lib.UpdateInstaller installer) - { - var pluginsPath = Path.Combine(MyAppPath, "AddOns"); - if (Directory.Exists(pluginsPath)) - { - foreach (var subdir in Directory.GetDirectories(pluginsPath, string.Empty, SearchOption.TopDirectoryOnly)) - { - var pluginPath = Path.Combine(subdir, Path.GetFileName(subdir) + ".dll"); - if (File.Exists(pluginPath)) - PluginManager.Instance.LoadPlugin(pluginPath, installer); - } - } - } -} \ No newline at end of file diff --git a/Pilz.Updating.UpdateInstaller/Main.cs b/Pilz.Updating.UpdateInstaller/Main.cs deleted file mode 100644 index 394d3b6..0000000 --- a/Pilz.Updating.UpdateInstaller/Main.cs +++ /dev/null @@ -1,142 +0,0 @@ -using Pilz.Updating.UpdateInstaller.Lib; -using Telerik.WinControls; -using Telerik.WinControls.Themes; - -namespace Pilz.Updating.UpdateInstaller; - -public partial class Main -{ - // C o n s t r u c t o r s - - public Main() - { - // G u i - this.Shown += Main_Shown; - this.FormClosed += Main_FormClosed; - this.FormClosing += Main_FormClosing; - - // Get arguments - var args = Environment.GetCommandLineArgs().Skip(1).ToArray(); - if (args.Length != 0) - { - // Load config - installer = new Lib.UpdateInstaller(UpdateInstallerConfig.Parse(args[0])); - General.LoadAddons(installer); - - // Init Form - InitializeComponent(); - - // Init Style - RadThemeComponentBase themeToUse = installer.Configuration.UIDarkMode ? new FluentDarkTheme() : new FluentTheme(); - ThemeResolutionService.ApplicationThemeName = themeToUse.ThemeName; - - // Init Application Header Text - string header; - if (!string.IsNullOrEmpty(installer.Configuration.ApplicationName)) - header = string.Format(My.Resources.UpdateInstallerGuiLangRes.String_UpdatingApplicationX, installer.Configuration.ApplicationName); - else - header = My.Resources.UpdateInstallerGuiLangRes.String_UpdateIsRunning; - - radLabel_Header.Text = $"{header}"; - } - - if (installer is null) - Environment.Exit(0); - } - - // F i e l d s - - private bool allowClose = false; - private readonly Lib.UpdateInstaller installer; - - // F e a t u r e s - - private void SetStatus(UpdateInstallerStatus newStatus) - { - string newStatusText = string.Empty; - Image newStatusImage = null; - - switch (newStatus) - { - case UpdateInstallerStatus.CopyingFiles: - newStatusText = My.Resources.UpdateInstallerGuiLangRes.Status_CopyingFiles; - break; - case UpdateInstallerStatus.Done: - newStatusText = My.Resources.UpdateInstallerGuiLangRes.Status_Done; - break; - case UpdateInstallerStatus.Extracting: - newStatusText = My.Resources.UpdateInstallerGuiLangRes.Status_Extracting; - break; - case UpdateInstallerStatus.RemovingFiles: - newStatusText = My.Resources.UpdateInstallerGuiLangRes.Status_RemovingFiles; - break; - case UpdateInstallerStatus.Waiting: - newStatusText = My.Resources.UpdateInstallerGuiLangRes.Status_Waiting; - break; - } - - switch (newStatus) - { - case UpdateInstallerStatus.CopyingFiles: - newStatusImage = MyIcons.icons8_copy_16px; - break; - case UpdateInstallerStatus.Extracting: - newStatusImage = MyIcons.icons8_open_archive_16px; - break; - case UpdateInstallerStatus.RemovingFiles: - newStatusImage = MyIcons.icons8_recycle_bin_16px; - break; - case UpdateInstallerStatus.Waiting: - newStatusImage = MyIcons.icons8_sand_timer_16px; - break; - case UpdateInstallerStatus.Done: - newStatusImage = MyIcons.icons8_checkmark_16px; - break; - } - - radLabel_Status.Text = newStatusText; - radLabel_Status.Image = newStatusImage; - - //if (newStatus == UpdateInstallerStatus.Done) - //{ - // allowClose = true; - // Close(); - //} - } - - private async Task WaitforHostApp() - { - SetStatus(UpdateInstallerStatus.Waiting); - await Task.Run(() => installer.WaitForHostApplication()); - } - - private async void ExecuteUpdate() - { - await Task.Run(() => installer.InstallUpdate()); - allowClose = true; - Close(); - } - - private async void Main_Shown(object sender, EventArgs e) - { - radWaitingBar1.StartWaiting(); - await WaitforHostApp(); - ExecuteUpdate(); - } - - private void Main_FormClosed(object sender, FormClosedEventArgs e) - { - installer.StartHostApplication(); - } - - private void Main_FormClosing(object sender, FormClosingEventArgs e) - { - radWaitingBar1.StopWaiting(); - e.Cancel = !allowClose; - } - - private void Installer_StatusChanges(object sender, UpdateInstallerStatusChangedEventArgs e) - { - base.Invoke(new Action(() => SetStatus(e.NewStatus))); - } -} \ No newline at end of file diff --git a/Pilz.Updating.UpdateInstaller/MyIcons.Designer.cs b/Pilz.Updating.UpdateInstaller/MyIcons.Designer.cs deleted file mode 100644 index 45a47f4..0000000 --- a/Pilz.Updating.UpdateInstaller/MyIcons.Designer.cs +++ /dev/null @@ -1,203 +0,0 @@ -//------------------------------------------------------------------------------ -// -// Dieser Code wurde von einem Tool generiert. -// Laufzeitversion:4.0.30319.42000 -// -// Änderungen an dieser Datei können falsches Verhalten verursachen und gehen verloren, wenn -// der Code erneut generiert wird. -// -//------------------------------------------------------------------------------ - -namespace Pilz.Updating.UpdateInstaller { - using System; - - - /// - /// Eine stark typisierte Ressourcenklasse zum Suchen von lokalisierten Zeichenfolgen usw. - /// - // Diese Klasse wurde von der StronglyTypedResourceBuilder automatisch generiert - // -Klasse über ein Tool wie ResGen oder Visual Studio automatisch generiert. - // Um einen Member hinzuzufügen oder zu entfernen, bearbeiten Sie die .ResX-Datei und führen dann ResGen - // mit der /str-Option erneut aus, oder Sie erstellen Ihr VS-Projekt neu. - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "17.0.0.0")] - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] - [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - internal class MyIcons { - - private static global::System.Resources.ResourceManager resourceMan; - - private static global::System.Globalization.CultureInfo resourceCulture; - - [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] - internal MyIcons() { - } - - /// - /// Gibt die zwischengespeicherte ResourceManager-Instanz zurück, die von dieser Klasse verwendet wird. - /// - [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] - internal static global::System.Resources.ResourceManager ResourceManager { - get { - if (object.ReferenceEquals(resourceMan, null)) { - global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Pilz.Updating.UpdateInstaller.MyIcons", typeof(MyIcons).Assembly); - resourceMan = temp; - } - return resourceMan; - } - } - - /// - /// Überschreibt die CurrentUICulture-Eigenschaft des aktuellen Threads für alle - /// Ressourcenzuordnungen, die diese stark typisierte Ressourcenklasse verwenden. - /// - [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] - internal static global::System.Globalization.CultureInfo Culture { - get { - return resourceCulture; - } - set { - resourceCulture = value; - } - } - - /// - /// Sucht eine lokalisierte Ressource vom Typ System.Drawing.Bitmap. - /// - internal static System.Drawing.Bitmap icons8_checkmark_16px { - get { - object obj = ResourceManager.GetObject("icons8_checkmark_16px", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - /// - /// Sucht eine lokalisierte Ressource vom Typ System.Drawing.Bitmap. - /// - internal static System.Drawing.Bitmap icons8_console_16px_1 { - get { - object obj = ResourceManager.GetObject("icons8_console_16px_1", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - /// - /// Sucht eine lokalisierte Ressource vom Typ System.Drawing.Bitmap. - /// - internal static System.Drawing.Bitmap icons8_copy_16px { - get { - object obj = ResourceManager.GetObject("icons8_copy_16px", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - /// - /// Sucht eine lokalisierte Ressource vom Typ System.Drawing.Bitmap. - /// - internal static System.Drawing.Bitmap icons8_installing_updates_12px { - get { - object obj = ResourceManager.GetObject("icons8_installing_updates_12px", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - /// - /// Sucht eine lokalisierte Ressource vom Typ System.Drawing.Bitmap. - /// - internal static System.Drawing.Bitmap icons8_installing_updates_16px { - get { - object obj = ResourceManager.GetObject("icons8_installing_updates_16px", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - /// - /// Sucht eine lokalisierte Ressource vom Typ System.Drawing.Bitmap. - /// - internal static System.Drawing.Bitmap icons8_installing_updates_32px { - get { - object obj = ResourceManager.GetObject("icons8_installing_updates_32px", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - /// - /// Sucht eine lokalisierte Ressource vom Typ System.Drawing.Bitmap. - /// - internal static System.Drawing.Bitmap icons8_installing_updates_48px { - get { - object obj = ResourceManager.GetObject("icons8_installing_updates_48px", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - /// - /// Sucht eine lokalisierte Ressource vom Typ System.Drawing.Bitmap. - /// - internal static System.Drawing.Bitmap icons8_open_archive_16px { - get { - object obj = ResourceManager.GetObject("icons8_open_archive_16px", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - /// - /// Sucht eine lokalisierte Ressource vom Typ System.Drawing.Bitmap. - /// - internal static System.Drawing.Bitmap icons8_recycle_bin_16px { - get { - object obj = ResourceManager.GetObject("icons8_recycle_bin_16px", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - /// - /// Sucht eine lokalisierte Ressource vom Typ System.Drawing.Bitmap. - /// - internal static System.Drawing.Bitmap icons8_sand_timer_16px { - get { - object obj = ResourceManager.GetObject("icons8_sand_timer_16px", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - /// - /// Sucht eine lokalisierte Ressource vom Typ System.Drawing.Bitmap. - /// - internal static System.Drawing.Bitmap icons8_uninstalling_updates_12px { - get { - object obj = ResourceManager.GetObject("icons8_uninstalling_updates_12px", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - /// - /// Sucht eine lokalisierte Ressource vom Typ System.Drawing.Bitmap. - /// - internal static System.Drawing.Bitmap icons8_uninstalling_updates_16px { - get { - object obj = ResourceManager.GetObject("icons8_uninstalling_updates_16px", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - /// - /// Sucht eine lokalisierte Ressource vom Typ System.Drawing.Bitmap. - /// - internal static System.Drawing.Bitmap icons8_uninstalling_updates_32px { - get { - object obj = ResourceManager.GetObject("icons8_uninstalling_updates_32px", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - /// - /// Sucht eine lokalisierte Ressource vom Typ System.Drawing.Bitmap. - /// - internal static System.Drawing.Bitmap icons8_uninstalling_updates_48px { - get { - object obj = ResourceManager.GetObject("icons8_uninstalling_updates_48px", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - } -} diff --git a/Pilz.Updating.UpdateInstaller/MyIcons.resx b/Pilz.Updating.UpdateInstaller/MyIcons.resx deleted file mode 100644 index a5f1195..0000000 --- a/Pilz.Updating.UpdateInstaller/MyIcons.resx +++ /dev/null @@ -1,163 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - text/microsoft-resx - - - 2.0 - - - System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - - Resources\icons8_checkmark_16px.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - Resources\icons8_console_16px_1.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - Resources\icons8_copy_16px.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - Resources\icons8_installing_updates_12px.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - Resources\icons8_installing_updates_16px.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - Resources\icons8_installing_updates_32px.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - Resources\icons8_installing_updates_48px.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - Resources\icons8_open_archive_16px.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - Resources\icons8_recycle_bin_16px.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - Resources\icons8_sand_timer_16px.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - Resources\icons8_uninstalling_updates_12px.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - Resources\icons8_uninstalling_updates_16px.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - Resources\icons8_uninstalling_updates_32px.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - Resources\icons8_uninstalling_updates_48px.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - \ No newline at end of file diff --git a/Pilz.Updating.UpdateInstaller/Program.cs b/Pilz.Updating.UpdateInstaller/Program.cs deleted file mode 100644 index 8a2d7b6..0000000 --- a/Pilz.Updating.UpdateInstaller/Program.cs +++ /dev/null @@ -1,12 +0,0 @@ -namespace Pilz.Updating.UpdateInstaller; - -internal static class Program -{ - internal static void Main(string[] args) - { - Application.EnableVisualStyles(); - Application.SetCompatibleTextRenderingDefault(false); - Application.SetHighDpiMode(HighDpiMode.PerMonitorV2); - Application.Run(new Main()); - } -} diff --git a/Pilz.Updating.UpdateInstaller/Properties/AssemblyInfo.cs b/Pilz.Updating.UpdateInstaller/Properties/AssemblyInfo.cs deleted file mode 100644 index 5778bea..0000000 --- a/Pilz.Updating.UpdateInstaller/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,7 +0,0 @@ -using global::System; -using global::System.Runtime.InteropServices; -[assembly: ComVisible(false)] - -// Die folgende GUID bestimmt die ID der Typbibliothek, wenn dieses Projekt für COM verfügbar gemacht wird. -[assembly: Guid("fe45e614-7cad-436a-b284-ee197d062ded")] - diff --git a/Pilz.Updating.UpdateInstaller/Properties/PublishProfiles/FolderProfile.pubxml b/Pilz.Updating.UpdateInstaller/Properties/PublishProfiles/FolderProfile.pubxml deleted file mode 100644 index de0c3db..0000000 --- a/Pilz.Updating.UpdateInstaller/Properties/PublishProfiles/FolderProfile.pubxml +++ /dev/null @@ -1,18 +0,0 @@ - - - - - Release - Any CPU - bin\publish\ - FileSystem - <_TargetId>Folder - net8.0-windows - win-x86 - true - true - false - - \ No newline at end of file diff --git a/Pilz.Updating.UpdateInstaller/Properties/Resources.Designer.cs b/Pilz.Updating.UpdateInstaller/Properties/Resources.Designer.cs deleted file mode 100644 index edb29c2..0000000 --- a/Pilz.Updating.UpdateInstaller/Properties/Resources.Designer.cs +++ /dev/null @@ -1,63 +0,0 @@ -//------------------------------------------------------------------------------ -// -// Dieser Code wurde von einem Tool generiert. -// Laufzeitversion:4.0.30319.42000 -// -// Änderungen an dieser Datei können falsches Verhalten verursachen und gehen verloren, wenn -// der Code erneut generiert wird. -// -//------------------------------------------------------------------------------ - -namespace Pilz.Updating.UpdateInstaller.My.Resources { - using System; - - - /// - /// Eine stark typisierte Ressourcenklasse zum Suchen von lokalisierten Zeichenfolgen usw. - /// - // Diese Klasse wurde von der StronglyTypedResourceBuilder automatisch generiert - // -Klasse über ein Tool wie ResGen oder Visual Studio automatisch generiert. - // Um einen Member hinzuzufügen oder zu entfernen, bearbeiten Sie die .ResX-Datei und führen dann ResGen - // mit der /str-Option erneut aus, oder Sie erstellen Ihr VS-Projekt neu. - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "17.0.0.0")] - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] - [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - internal class Resources { - - private static global::System.Resources.ResourceManager resourceMan; - - private static global::System.Globalization.CultureInfo resourceCulture; - - [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] - internal Resources() { - } - - /// - /// Gibt die zwischengespeicherte ResourceManager-Instanz zurück, die von dieser Klasse verwendet wird. - /// - [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] - internal static global::System.Resources.ResourceManager ResourceManager { - get { - if (object.ReferenceEquals(resourceMan, null)) { - global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Pilz.Updating.UpdateInstaller.Properties.Resources", typeof(Resources).Assembly); - resourceMan = temp; - } - return resourceMan; - } - } - - /// - /// Überschreibt die CurrentUICulture-Eigenschaft des aktuellen Threads für alle - /// Ressourcenzuordnungen, die diese stark typisierte Ressourcenklasse verwenden. - /// - [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] - internal static global::System.Globalization.CultureInfo Culture { - get { - return resourceCulture; - } - set { - resourceCulture = value; - } - } - } -} diff --git a/Pilz.Updating.UpdateInstaller/Properties/Resources.resx b/Pilz.Updating.UpdateInstaller/Properties/Resources.resx deleted file mode 100644 index 1af7de1..0000000 --- a/Pilz.Updating.UpdateInstaller/Properties/Resources.resx +++ /dev/null @@ -1,120 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - text/microsoft-resx - - - 2.0 - - - System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - \ No newline at end of file diff --git a/Pilz.Updating.UpdateInstaller/Properties/Settings.Designer.cs b/Pilz.Updating.UpdateInstaller/Properties/Settings.Designer.cs deleted file mode 100644 index dfb5f04..0000000 --- a/Pilz.Updating.UpdateInstaller/Properties/Settings.Designer.cs +++ /dev/null @@ -1,26 +0,0 @@ -//------------------------------------------------------------------------------ -// -// Dieser Code wurde von einem Tool generiert. -// Laufzeitversion:4.0.30319.42000 -// -// Änderungen an dieser Datei können falsches Verhalten verursachen und gehen verloren, wenn -// der Code erneut generiert wird. -// -//------------------------------------------------------------------------------ - -namespace Pilz.Updating.UpdateInstaller.My { - - - [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "15.9.0.0")] - internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase { - - private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); - - public static Settings Default { - get { - return defaultInstance; - } - } - } -} diff --git a/Pilz.Updating.UpdateInstaller/Properties/Settings.settings b/Pilz.Updating.UpdateInstaller/Properties/Settings.settings deleted file mode 100644 index 85b890b..0000000 --- a/Pilz.Updating.UpdateInstaller/Properties/Settings.settings +++ /dev/null @@ -1,7 +0,0 @@ - - - - - - - diff --git a/Pilz.Updating.UpdateInstaller/Resources/icons8_checkmark_16px.png b/Pilz.Updating.UpdateInstaller/Resources/icons8_checkmark_16px.png deleted file mode 100644 index 15b6e2c3873bc02fbd87f9f51480336d6507560f..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 337 zcmV-X0j~auP)wAzcARk2G$G9|ubiuvgw#ZEkB!G?~ ze*V7=DE|G=e`X(;%|JdFfemn4=x+A+ALCue`5szRe!st-$7YU5#UX1W2mb^Ch6lM8_x4$yasc|4!PC{xWt~$(69D+lc@+Qv diff --git a/Pilz.Updating.UpdateInstaller/Resources/icons8_copy_16px.png b/Pilz.Updating.UpdateInstaller/Resources/icons8_copy_16px.png deleted file mode 100644 index ea7ac181fab47d417677200dc3f453c9dc543175..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 422 zcmV;X0a^ZuP)IEqtMg|i}W{^AzmgQ&q`Q-f{&wLBc{V)j>FMR*>h2hcFy9{q0zl6!7(8kit z?6QI^JNi%maDhpn7{J2L#=tKo$iT(V4Uh z3~mF80e^n}V)*##J;OH^UZ6sLhSRs-Gdz9!9mqx?Q#C;bX(3Ly0Ez){Q5=i_3n>g4 z6azTevjCCtIV3yM<^2Z(Px`OF|K%!wj~5{N)GBqO*B_C<5U)5L_6 zKSO~gt$OzM2TB+a^a4;53Nlp{WB_3lK{O8B1<2w|{}~_uWBR`uS&U|E097VaUkIE9 Q4*&oF07*qoM6N<$f_+!9Gynhq diff --git a/Pilz.Updating.UpdateInstaller/Resources/icons8_installing_updates_12px.png b/Pilz.Updating.UpdateInstaller/Resources/icons8_installing_updates_12px.png deleted file mode 100644 index fd633e26634ae3f643f6f092f46ad6ac393ba813..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 347 zcmV-h0i^zkP)Y2x4QijdlJ) zz>n6(A0SsNq>WXGq*o9@?smsFi+6}fAj7;j?+r6ByTF3s{?2>vrQR<~>*r5JK_5*w zXczo_e=T&}85CoMyR`vT9Es>|R_VYWKE7EmH!_5dTyo&tG%+RM9PU&d>RguTF9?W{ zAq02LIwPj<+0u5t5_bT7rJu!!8`hNVLUMqes6U#;{nE6|b|K63gnpgaS`A+>^@oh9 zH;D}q9J8j(6O*zkUh&bN|35koIFiy%NTMNrqf~q4gZa*LaX=qUH%JRT-|O-#x|kPv tJsJ7YB%Kt3^qq^Rm=hXg2w;ds;~Q|!S@8>>A@%?O002ovPDHLkV1jjAklz3R diff --git a/Pilz.Updating.UpdateInstaller/Resources/icons8_installing_updates_16px.png b/Pilz.Updating.UpdateInstaller/Resources/icons8_installing_updates_16px.png deleted file mode 100644 index 24206ffd061bab78aac8ee1c5a25359a919cd888..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 454 zcmV;%0XhDOP)y515ps2*-f+-ENtyXP&*%Bf<-V7un9I6>JM0|LArmN|3Iofr4c68-bzzxwwZ%M&(@ zt!dt)pZk;C)2He|Sc3s`wrRY;LN!HFl6ey!*15XA-@=bas9u4^T;e_q~by(@5=i!jFZYQDLv+8{Qd)JPRXWKoko@rp7DVUM9k zZb@r`c;qlVQlQdJx&xX6jJ-u-CSs)yZn~gC5xap{w1=RFKX3=`0@|qPMllah)EcBh ziw&q|od+y!vYL0+N%$}9OBtL%>CNB{r;07*qoM6N<$f(1s%z5oCK diff --git a/Pilz.Updating.UpdateInstaller/Resources/icons8_installing_updates_32px.png b/Pilz.Updating.UpdateInstaller/Resources/icons8_installing_updates_32px.png deleted file mode 100644 index d582bff9f24892ffb5d339f229139a507692723f..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 866 zcmV-o1D*VdP)&zL$9)u(lfah%T5!jfRGMJfTfPk0 z50EIGDGrTR5cLD3g32e2Bu6ZYMhSWoAG(o|L>ChxizE=5%kJBgGwzw$dm6`wAUv#f z_P4&Z_S*ZbeK|zS&p)mJ7c#zo(0iO&w5olXt((Dy$Gs|-54Q6O%8X&AqeQ$<<%JMG zVfR88CDx*%lfi=5CZW>mIK{1pIhVk394l7!XWXUt9WGT$L+lnyonPa*gk4N1nJEsN$Rx2n^Qwh{d%(9mG47eGs@6x(ce3 z?;vjprY06tL3prNe8Gm18-QA2Eep~K)vk_`H33)(U5b1|Wj4vm=#m)sK!mIyIxKZ? zq@YrK$ax8LYUxPHp)_@}HRuocPl%YkUMk9b5^=LolXy)I+vsqusE$N`T}JY@j2JF?B z{%)Q4!Q4(5`d2+}$$II+;Ic6)3gkCAjTOLA(FHDZ|7`_+13lx`4q=%l6aWAK07*qoM6N<$g1Xj)jsO4v diff --git a/Pilz.Updating.UpdateInstaller/Resources/icons8_installing_updates_48px.png b/Pilz.Updating.UpdateInstaller/Resources/icons8_installing_updates_48px.png deleted file mode 100644 index 89b1fc6683ed21cabf155e5f2e79af329c0236b9..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1217 zcmV;y1U~zTP)Ji zZxSckZuVz3xCGEz@9n&Kzw_SCy!8;pzqkT%1^&|&VC`Og&PtynVt0A^l{8t*miK$g z*2!#Z0{Kd>(X8spED!q6Tq%7&6KwOG(edH%p)b{TSv8h|-$o=?=UxP3atHY5fvfP$ z7x#AD)LeK-a(T6Qxbn%WK!b>M26CkXyGe@g;CB;nhM0WYkn$bsrkY*jC$RLV!S4nJ zL5&!luJVoo%r^68@<}B16b#hXYS<+9ylzhXfVmb#OTbEhg${GT<+&~y%`!>1Q>35# z8NPa8(g}3JSkWvWbTWcy79@1a2CU36M)D&k?|RWp%43CW<*bf>tpxICd%K${ei07U z{>5Hkncmj9T*6b(F?`H<8Qf?CNZBJ80~wJF**f0 z3}!eJkA^8JIa3cE%v-%%ZA!c=NgnmnSCucAKaAJ=9$4yIfWZOi?~a)d$xjmruLK(Ca*r3x@);jPPd4}D1~3a| zJBdGc_etBmV+fF_IuGBzh#LGc<5~*NyAuBF~H9?B2`6vd5_|HNnNQFx@Ood z;TrSSL=3lxz(H#Z8S`6C;ZvJ-Zq zvGa0IbvKfG1RY9&smv%Br>wB>HU;a9yytJe#R+Ug)#I3P f1>y?)k1FsNlnz8xs1}%_00000NkvXXu0mjfo9{*t diff --git a/Pilz.Updating.UpdateInstaller/Resources/icons8_open_archive_16px.png b/Pilz.Updating.UpdateInstaller/Resources/icons8_open_archive_16px.png deleted file mode 100644 index 45d2ad0b86462fd58ede285548acfe1439360d40..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 435 zcmV;k0ZjghP)QYIG+O$MS@w$BZ?%rv)?J=xKUO?2-gCBN7>C?18Ov<0EdF2 zh1{8gY~Z3@FVG5pB>*hlJ+5LjwBWhkLM-l{R#++_l5nU|$jdl9sG|2cfJ_uL%`FsE z;lCgRPzFxwI{I&`h{6zO`v$XwN(E#U8MWsD*ePWd@%W6G3JBZ)_TU4MBzpe=NJe4x z38ez;;RKD&9uNWVFB5Fm))URl5T6Xq7^M|hPd2Q+4Wp=2N4!!e$Y~jLE{?=qOK$1} dOEv!+egi^SYT0?9RwDoa002ovPDHLkV1oXSz3%`3 diff --git a/Pilz.Updating.UpdateInstaller/Resources/icons8_recycle_bin_16px.png b/Pilz.Updating.UpdateInstaller/Resources/icons8_recycle_bin_16px.png deleted file mode 100644 index 81a9d1b2bb497d9c8c8237e41caa56caee5b83ec..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 552 zcmV+@0@wYCP)t6+sDXsZ1ribnzXW2eB@iJPl~&99aqsb*n%?%s&;?)aci(r;`Oe9C z=N;ghk80*WdolNr;B+_bPHzQMpPrmp6irkvL1v&Z6LFj@5s7&vl;U*4R~Cc|l*Y!F z@;5LMkJzSI^Y8IA;phU(&4|+^o;KTo>6|QDpEX*WE#U%NK#|(x>c7P)sCyc3R?o4p zRf8L}KFihgi%5MGjlj+zAYFEKw93vT122~4f&!hn-U&nOq-cNBf~-F&rLOv0bU+UZDrBHh%hNydpY*BbVUOUF8Ktm%>** zUE;$R7q_xW6ndk0yLN(wwNnYfkgAtTihF99upNlWf3PuwQdZ&h`!c3#XXqc!W8KT( z>79f~1PzT4LAU_$!?1Vkb_%ba6cKS0{Ad@(Ir)Ar28kI>-&tZ$xB#g`U(*BGg<}5i z(5#Y4z&l`+bHLOdI|K1(V|F_2g6sg=c0h7M9qewdW|zzR;=dAu!^K>CFjSyBar61$ qQ1KjaBJH9UH#(V4&A06T!2STl;;eHb@89|W0000(@`~fBzX+kmZ;d8UC=bu^%m-G$#mI z97PdC;@{-=Z{G$&*r=qqq{L)Y5e5bf7l0HjT(|$YrWB9G<4^w?e*XOr5@PuC?d!3) zU?*!Z2Z_Mq0tN;t0~;+V5hjL@Z~h@EWza(Az}QSM1~Sda$Z+Q4Ph=4=`xKZ&Bd{9q z=l}nrmtX#UV?oG%WM=rAho%?IMJNGtA%uq#+r@v33_gGUF@W6h6BtmwPD&g%A+o3> zRs%pvfYAsGfd7AS1U5(=&~Oliiuc|7q5hYF`GmlSqXHnk9|f%5GyMN+;iAlO3sofp z16CLOWn}K-`*c>o;G7==2=jb8FZiF4xffkCh>z6(mfxRk^)Cc7u>AQ1#2*_8gOG1heO=*-^x98ZPx*nj>8tN+O^#PICYo_k;p8i5f8z4@s=uU|gjjHV9E6&4lu zDV;obE0_Z%FkSHfUpOx>|3e0b|IAP|P>S&{Gb2Mdkb`0XkWU!`02c#xNWl}TAOHXW M07*qoM6N<$f}gd`u>b%7 diff --git a/Pilz.Updating.UpdateInstaller/Resources/icons8_uninstalling_updates_12px.png b/Pilz.Updating.UpdateInstaller/Resources/icons8_uninstalling_updates_12px.png deleted file mode 100644 index 01da6360fbb868221a85b4b120b7d0cc25917440..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 363 zcmV-x0hIoUP)gm4f>ywojw<*O!;Q<~ce&LO-!m8NhW5R;8zB7jS# zOs74jD-47|zl3m}P@|ysOU|j9;JiCGCL2c|-!bT4vj<8zij>xTaML4jzc{}jXB|J* z??hVK>g~{fXT8t!9Ny=c6~+|XMNv#v3ZV($0J9>54uB5kjc=RWVF+;xMj-$I002ov JPDHLkV1feflDz-` diff --git a/Pilz.Updating.UpdateInstaller/Resources/icons8_uninstalling_updates_16px.png b/Pilz.Updating.UpdateInstaller/Resources/icons8_uninstalling_updates_16px.png deleted file mode 100644 index 550d18f7bac1658738848f2d0fd8c12513cd3c7c..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 479 zcmV<50U-W~P)#AuO1Q4q0?Ws0P; z(biJ*2j~w_5F4?H5+RjA&_at8;zy7mLLwv)PP608T{dz-K~OyA&3pT1c5d$j;FlME zx4#yThkbr~O6o1!p9>WVRngs0-G*6PJ@zaj>+ftx!TR{Xjg+qSYz4Ca6*@^9X5#oxJJ@* zU_8$NBFZA-2_Y2u^NhV6?)%$~Hm}clKuiN>+uqkyofr*CrJ0Ck>WLT$8q?!x@k~v$ zf#(EbhVvISVXfd4`F{{i@2VhdYNG!P{Alj1qrpLbL|6YLC(C7LuhnTLTI}fm6d(PA Vdw=H8piKY(002ovPDHLkV1jDf(dhsH diff --git a/Pilz.Updating.UpdateInstaller/Resources/icons8_uninstalling_updates_32px.png b/Pilz.Updating.UpdateInstaller/Resources/icons8_uninstalling_updates_32px.png deleted file mode 100644 index 6bc8c5bf718e56d466ad71545c297f91cbd9a808..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 873 zcmV-v1D5=WP)S$`=~f039j<@Vao0wd9ZT&!?r7N+Dgq_8irD+Gl`GqX!MC#jylJj|oAg*Se^*^Cl5%WmHpzA&fgJ@N?k@DvTvX)U4d^ zn2OsklTjNaBiKkPRy>_c{-fpP2ruB|iDC{)l8=z*9e{bVm5R=`qm;IybM0iFXig`d zQE5Oc(OWAF>TOrL-K(J8L(9C$AsmO8DPeCA9i< zBBriDByZsbf3B-rAEznt;BKm{;#8m;n4slf^n1lqOzfJMnnQ0vXh;E@9H28E7@2H> z4#Ip9?G>m7VRI*1Z1^HG^;sm_fWJfTYfN&SB)2Lq2#at_uzeLhzKf%dzZGg+!{ety z$9|bS>wcGUGIMCDg1hYtzG;mE%(v9-E@5MT`J2fp2lJavKhTY71U`Y|*??3S;Ivf? z$9^JOb8*y3dj+bfclj-^#{4}GTL)0^1pG7%wr^M@p15m5(2P6Zj@NqvctdijL)FzX z7unjZZEh}S%}qXpTem5{hw#PL$!{zD2Pg0woFdj04faMv00000NkvXXu0mjfUrCM( diff --git a/Pilz.Updating.UpdateInstaller/Resources/icons8_uninstalling_updates_48px.png b/Pilz.Updating.UpdateInstaller/Resources/icons8_uninstalling_updates_48px.png deleted file mode 100644 index 64ce6dd5873a117a1be3e230fe70663717bfc24c..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1220 zcmV;#1UvhQP)g|!BfA;?Xor1HK=z>Pz=~Gq|buajIGyd8-*u? z;jXsLEPn2_1&u?Uf!v|~`^carfSTY{BL2j1=>25!??3Hw`xue?4s;3Fl!SmqA!yu6 zteh^EI`%p2V4ir2h;9KpnEya}cK#B^S_C{TzjdcvcHnCwF|;mhTv$*+Fy$e(gTv4Y zl1&3IzHJiI`Si@f@HU-~pk2WAY~N8Pp76nHnn|!Yimh~32T-ekYlDO7l$rktfIVPs zie*O7U_q6+Y3(^1j?0!=?B(;9>vF2P-5&Y;*PEz4sr$LN)T3LhtZ>uF%au+8PlUy4q0hY80^e}QDWl@LA2xi#GiSQ zS{^&Bm|0b?O`oIknGdUi=ZYts;}RWfo1Op6qYfN~E)J1~M=mgU$0LSYC9kAy5uvSd1y)2I06Sr5a z%SiAp@Xer~t-bcWJo#feD45;~0EmS+6$I8SJG%O^PVzFIRsqt{`eyMQ&cciwdsz?_ zakzi;>U73P^4IFz8gG2iShEXX)@YTYb^#K>ag672FM%apK|wE-fk$@ZSBfOWtss-zAs{h=~8qHk&eJUQv$ z$+D&m*0p)vOs;38ME-c)Q^B-MauA6I9pF%e-eKm4afVwx4 iCF(%bfv5u-9rzDe!X|y_Y&K8;0000Ni%m?th03l<2FwW8}HAyPt!+S;Oi9QwZxeM^>1 z=+_Fd@^T^S>Wcc}eevZus-=$@dUQ8F<*TW&O~gZHR?7tUx;8kb1BrAokcsWGqup_pkckjM?V&x>SNYt zU}$gOSB3@(--fz2;-&2^9EIBaWfS5b9*^rjVxx~mf5^%!-pI&XPizdvpLTsISA69Dsn@cy=lGp75?_@^&X?;d zJ74`g9@igwV5`h;S}AiaD<-dtn)eRDYg5>B^p)SZQXag2tM>T!!n`maKKc*?=gak6 zI(5!RtS}#)Ei2yV@wnd6ocwc`ZCGD!O#+Tn!X{s*cs#Bb-zP-BS41q?bVB~(=}*eh zC$9{BFBpb5)13GrkH_^)It-8>%G;r-&;sQCCE6ys5Bl4ckZ ztvnvrv+4TJsp6|*moUKlS)8M?Z(p5U%Hwgpz5Vu&fc<&yLl@fs!~fQ-Nqv~d3)911 z1Do1!lwa@te5p}9lEJZ!>uwCof%e=dEWj1sE35N}V-%O9ZobL6Pw`D&0~D8}F22dR zPw{oHftdWY=RU=cdJPay;!TqJRnp|#r}%iDf}hCi0L3M#iaXK&elB<0hseK)1iKfb zd{SJJQFCGJ1(TS;IqfYgZh+7JZ>juJT#~AJ(Em61Tn=}I>>ufL!zJ0~L;~tTBX1O! zBp*i|ZLyx&N7h?VT#|YVzcb`tL}Re|^?u=alYz%MA(ovLV$m5PE;Vg9KdhmzU^_3w zPI+#b9B+Y`c%K4a9Bt6(KE;>d-f8tw%|JB+7e)pi9?V}oJdl41KI6aV>vO(^pLb#I zlZU^t{i-$&LxXwid+OlxpE|$3 z#?@402?suJG__g!B&mpIM!MljF$G51nq}vyyXkc=>oGv6;l;_;fn@d~i>X?CoAD;r?vc zeWSAWb*;Hc;yv#JfB~`S@bdBf_uU~oTW=~W#)!}MrMO*y0XcAdI(=JrW66g}oN~^= zb3liekLTd{l@pVVZ#WI4k|#Jmo!*g7 z9B_%-3E%&`^xP-pubx?G`(02N-~Bqgd_0p*cE`m}*y$dcD~D`TY6Hio(=#oJx;Xeb zb{`zz9{n;MUOv9AvEg!C{3`6O91sh~XQBgs;~J#H?!dvi_7FF~Z&ZU!vB%;NqxKMf zlNw};Jq8Es+C%tFYS7b1uaRTFyktrvj9l`0XsdgT#i>0d{4r|~$4$BpYuI?4+C%u` z)F8w_c)1M2r|XMbdx!)0H?Bd1h2tij#w}#*+7rNURD*(;2rrkxIY!SNY7gNzsX-hI z$4xq)XQ0QfJ%rz+25}sOmrFiRr@Pdi68;!9h~p+*hnJ7L)E>g0YpT19`_<`$mrI=; zA8&1~|2W}rk>K|f_Z_8k+@wd@gpB>s1#{3AKL0!r;$L~~B)nYO_<-;EcLg!HJfB$m z^oD7Cj+=B-dzg31_xgl&t5a9Oad-lJzpcYTc)8Ts!T4#YcaOVXb6t)V+H%~ayZWt^ zJ>liDQt@5maNMN3`mNemGf>UI)C?4t4B`Ja;Uhw#8H~evBUo`H1gt@Vl}MGB6yH<= zqm*YC74yfXga?j?OI)W_2dy6(th@c+$*+T)g;fzoBmgQ;h!?H>DkRuIj~;e z%9CM&sgiS+yxdhT`i(6h>RVe14SgxiH50*y?kEV-!YPzI;CU9=vypENogO*S9t(zaKUD9{F2{D|Vl`gFRv7?t6;=FJ#M?&);|NW{LiM;;V$O zY)fkVJm7q6b=+I15_roIBM+}vTfTh$`n9w7^{&g=hPIoX`DdF`XLWIA?Ktd($&aV4 z4&0{fhdFDxhVFkeeSc1C{(=2GeRJ<#w_J9&EiYSr3EN-PmVauJoC6QFpZLeU2E^s=BL_ZeKk<)q4RGb|ngbuTpZMEe1AK9J$bq-oPdTu; z2H@V7kM6rZv=JwjRN0|V^V;jL_LulOUIPfbiZ}JsJQwM+_7i`XYe0|-@l?s++}O`O z)_&q2_Zq-CsCZL9pC3o}S^J59oNGWBcH*g$VK%mXK5IYmx4j0aFspb|zsk;{-+S$+ z8~_IA&jG|!B`tU=t_S{We~G_`Yk-P3^}F&fN9`y6KCS`8Qzc#bXUb6fiNB9)fQmQu zyYeqb?I->|t^veTC0+TKqxKX3iQhK*mkUM}Z|ZmP4STk~=j)yiapn^6opixSJXO-g zH`Ko8I9}g6#AtKDsNzliF23RaXr0%4>hd-58h9ZtPU5MOas7hb$#S3jl$*A;x&;vL z$8oT#cvF8IpRjNIPuDl!@=?N9Avv#Ob>bGldl1?)^jmE@Njz0jXFoYU9`iw1m(c)x zo!5C+C}%>&oBAt-W2WK|PnDc0T$PHe;!XXP!ZA~E=(iXZa%84(RpVAOP|ZL!0~cBb ziu(t|_&bJ~nlEub1Kio5BvHj}31*AzM<4-wI(-!9*GOq9$8bL6!BoNz^}x^dNU4+X hBR%j_J+S@5ge-210S5~8@#A#{yx>D6i=&#q{|Ct)L%09{ diff --git a/Pilz.Updating.sln b/Pilz.Updating.sln index 93f7ffd..67120bc 100644 --- a/Pilz.Updating.sln +++ b/Pilz.Updating.sln @@ -7,16 +7,10 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Pilz.Updating.Client", "Pil EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Pilz.Updating.GUIBase", "Pilz.Updating.GUIBase\Pilz.Updating.GUIBase.csproj", "{F668FCAA-0155-4C5C-8881-731AA9BC389C}" EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Pilz.Updating.UpdateInstaller", "Pilz.Updating.UpdateInstaller\Pilz.Updating.UpdateInstaller.csproj", "{6CF782BA-019D-4651-9B00-48D2729B808F}" -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Pilz.Updating.Client.GUI", "Pilz.Updating.Client.GUI\Pilz.Updating.Client.GUI.csproj", "{4C91A7F0-FC08-4CA9-85E1-5B6304E033F3}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Pilz.Updating.Client.Gui", "Pilz.Updating.Client.Gui\Pilz.Updating.Client.Gui.csproj", "{4C91A7F0-FC08-4CA9-85E1-5B6304E033F3}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Pilz.Updating", "Pilz.Updating\Pilz.Updating.csproj", "{CFC81C75-299C-4DE4-9F19-8E061972E271}" EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Pilz.Updating.UpdateInstaller.Lib", "Pilz.Updating.UpdateInstaller.Lib\Pilz.Updating.UpdateInstaller.Lib.csproj", "{F05AAEA2-386F-4307-AE5E-6831F4EA2B66}" -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Pilz.Updating.Test", "Pilz.Updating.Test\Pilz.Updating.Test.csproj", "{B98D1EA1-0C02-4337-97AD-B321EDD443E3}" -EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -31,10 +25,6 @@ Global {F668FCAA-0155-4C5C-8881-731AA9BC389C}.Debug|Any CPU.Build.0 = Debug|Any CPU {F668FCAA-0155-4C5C-8881-731AA9BC389C}.Release|Any CPU.ActiveCfg = Release|Any CPU {F668FCAA-0155-4C5C-8881-731AA9BC389C}.Release|Any CPU.Build.0 = Release|Any CPU - {6CF782BA-019D-4651-9B00-48D2729B808F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {6CF782BA-019D-4651-9B00-48D2729B808F}.Debug|Any CPU.Build.0 = Debug|Any CPU - {6CF782BA-019D-4651-9B00-48D2729B808F}.Release|Any CPU.ActiveCfg = Release|Any CPU - {6CF782BA-019D-4651-9B00-48D2729B808F}.Release|Any CPU.Build.0 = Release|Any CPU {4C91A7F0-FC08-4CA9-85E1-5B6304E033F3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {4C91A7F0-FC08-4CA9-85E1-5B6304E033F3}.Debug|Any CPU.Build.0 = Debug|Any CPU {4C91A7F0-FC08-4CA9-85E1-5B6304E033F3}.Release|Any CPU.ActiveCfg = Release|Any CPU @@ -43,14 +33,6 @@ Global {CFC81C75-299C-4DE4-9F19-8E061972E271}.Debug|Any CPU.Build.0 = Debug|Any CPU {CFC81C75-299C-4DE4-9F19-8E061972E271}.Release|Any CPU.ActiveCfg = Release|Any CPU {CFC81C75-299C-4DE4-9F19-8E061972E271}.Release|Any CPU.Build.0 = Release|Any CPU - {F05AAEA2-386F-4307-AE5E-6831F4EA2B66}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {F05AAEA2-386F-4307-AE5E-6831F4EA2B66}.Debug|Any CPU.Build.0 = Debug|Any CPU - {F05AAEA2-386F-4307-AE5E-6831F4EA2B66}.Release|Any CPU.ActiveCfg = Release|Any CPU - {F05AAEA2-386F-4307-AE5E-6831F4EA2B66}.Release|Any CPU.Build.0 = Release|Any CPU - {B98D1EA1-0C02-4337-97AD-B321EDD443E3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {B98D1EA1-0C02-4337-97AD-B321EDD443E3}.Debug|Any CPU.Build.0 = Debug|Any CPU - {B98D1EA1-0C02-4337-97AD-B321EDD443E3}.Release|Any CPU.ActiveCfg = Release|Any CPU - {B98D1EA1-0C02-4337-97AD-B321EDD443E3}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/Pilz.Updating/AppVersion.cs b/Pilz.Updating/AppVersion.cs new file mode 100644 index 0000000..245ca98 --- /dev/null +++ b/Pilz.Updating/AppVersion.cs @@ -0,0 +1,109 @@ +using Newtonsoft.Json; + +namespace Pilz.Updating; + +public class AppVersion(Version version, int build, Channels channel) +{ + // P r o p e r t i e s + + [JsonConverter(typeof(Newtonsoft.Json.Converters.VersionConverter))] + public Version Version { get; set; } = version; + [JsonConverter(typeof(Newtonsoft.Json.Converters.StringEnumConverter))] + public Channels Channel { get; set; } = channel; + public int Build { get; set; } = build; + + // C o n s t r u c t o r s + + public AppVersion() : this(new Version("1.0.0.0")) + { + } + + public AppVersion(Version version) : this(version, 1, Channels.Stable) + { + } + + // F e a t u r e s + + public override string ToString() + { + if (Channel == Channels.Stable && Build == 1) + return Version.ToString(); + + return $"{Version} {Channel} {Build}"; + } + + public override bool Equals(object obj) + { + if (ReferenceEquals(this, obj)) + return true; + if (obj is not AppVersion applicationVersion) + return false; + return applicationVersion == this; + } + + public override int GetHashCode() + { + return ToString().GetHashCode(); + } + + public static bool TryParse(string input, out AppVersion version) + { + try + { + version = Parse(input); + } + catch(Exception) + { + version = null; + } + return version != null; + } + + public static AppVersion Parse(string input) + { + var splitted = input.Split(' '); + + if (splitted.Length < 1 || !Version.TryParse(splitted[0], out Version? version) || version == null) + throw new FormatException(); + + if (splitted.Length < 2 || !Enum.TryParse(splitted[1], out Channels channel)) + channel = Channels.Stable; + + if (splitted.Length < 3 || !int.TryParse(splitted[2], out int build)) + build = 1; + + return new AppVersion(version, build, channel); + } + + // O p e r a t o r s + + public static bool operator >(AppVersion a, AppVersion b) + { + return a.Version > b.Version || a.Version == b.Version && (a.Channel < b.Channel || (a.Channel == b.Channel && a.Build > b.Build)); + } + + public static bool operator <(AppVersion a, AppVersion b) + { + return a.Version < b.Version || a.Version == b.Version && (a.Channel > b.Channel || (a.Channel == b.Channel && a.Build < b.Build)); + } + + public static bool operator ==(AppVersion a, AppVersion b) + { + return a.Version == b.Version && a.Channel == b.Channel && a.Build == b.Build; + } + + public static bool operator !=(AppVersion a, AppVersion b) + { + return a.Version != b.Version || a.Channel != b.Channel || a.Build != b.Build; + } + + public static bool operator >=(AppVersion a, AppVersion b) + { + return a == b || a > b; + } + + public static bool operator <=(AppVersion a, AppVersion b) + { + return a == b || a < b; + } +} \ No newline at end of file diff --git a/Pilz.Updating/ApplicationVersion.cs b/Pilz.Updating/ApplicationVersion.cs deleted file mode 100644 index feea620..0000000 --- a/Pilz.Updating/ApplicationVersion.cs +++ /dev/null @@ -1,63 +0,0 @@ -using Newtonsoft.Json; - -namespace Pilz.Updating; - -public class ApplicationVersion(Version version, int build, Channels channel) -{ - // P r o p e r t i e s - - [JsonConverter(typeof(Newtonsoft.Json.Converters.VersionConverter))] - public Version Version { get; set; } = version; - public int Build { get; set; } = build; - [JsonConverter(typeof(Newtonsoft.Json.Converters.StringEnumConverter))] - public Channels Channel { get; set; } = channel; - - // C o n s t r u c t o r s - - public ApplicationVersion() : this(new Version("1.0.0.0")) - { - } - - public ApplicationVersion(Version version) : this(version, 1, Channels.Stable) - { - } - - // F e a t u r e s - - public override string ToString() - { - return $"{Version.ToString()} {Channel.ToString()} {Build}"; - } - - // O p e r a t o r s - - public static bool operator >(ApplicationVersion a, ApplicationVersion b) - { - return a.Version > b.Version || a.Version == b.Version && (a.Channel < b.Channel || (a.Channel == b.Channel && a.Build > b.Build)); - } - - public static bool operator <(ApplicationVersion a, ApplicationVersion b) - { - return a.Version < b.Version || a.Version == b.Version && (a.Channel > b.Channel || (a.Channel == b.Channel && a.Build < b.Build)); - } - - public static bool operator ==(ApplicationVersion a, ApplicationVersion b) - { - return a.Version == b.Version && a.Channel == b.Channel && a.Build == b.Build; - } - - public static bool operator !=(ApplicationVersion a, ApplicationVersion b) - { - return a.Version != b.Version || a.Channel != b.Channel || a.Build != b.Build; - } - - public static bool operator >=(ApplicationVersion a, ApplicationVersion b) - { - return a == b || a > b; - } - - public static bool operator <=(ApplicationVersion a, ApplicationVersion b) - { - return a == b || a < b; - } -} \ No newline at end of file diff --git a/Pilz.Updating/Json/AppVersionStringJsonConverter.cs b/Pilz.Updating/Json/AppVersionStringJsonConverter.cs new file mode 100644 index 0000000..3256b89 --- /dev/null +++ b/Pilz.Updating/Json/AppVersionStringJsonConverter.cs @@ -0,0 +1,82 @@ +using Newtonsoft.Json.Serialization; +using Newtonsoft.Json; +using System.Globalization; +using Newtonsoft.Json.Linq; + +namespace Pilz.Updating.Json; + +public class AppVersionStringJsonConverter : JsonConverter +{ + /// + /// Writes the JSON representation of the object. + /// + /// The to write to. + /// The value. + /// The calling serializer. + public override void WriteJson(JsonWriter writer, object? value, JsonSerializer serializer) + { + if (value == null) + { + writer.WriteNull(); + return; + } + + if (value is not AppVersion appVersion) + writer.WriteValue(value); + else + writer.WriteValue(appVersion.ToString()); + } + + /// + /// Reads the JSON representation of the object. + /// + /// The to read from. + /// Type of the object. + /// The existing value of object being read. + /// The calling serializer. + /// The object value. + public override object? ReadJson(JsonReader reader, Type objectType, object? existingValue, JsonSerializer serializer) + { + if (reader.TokenType == JsonToken.Null) + return null; + + try + { + if (reader.TokenType == JsonToken.String) + { + var strValue = reader.Value?.ToString(); + + if (string.IsNullOrWhiteSpace(strValue)) + return null; + + return AppVersion.Parse(strValue); + + } + + if (reader.TokenType == JsonToken.StartObject) + { + return JToken.ReadFrom(reader).ToObject(); + } + + } + catch (Exception ex) + { + throw new JsonSerializationException("Error converting value {0} to type '{1}'.", ex); + } + + // we don't actually expect to get here. + throw new JsonSerializationException("Unexpected token {0} when parsing app version."); + } + + /// + /// Determines whether this instance can convert the specified object type. + /// + /// Type of the object. + /// + /// true if this instance can convert the specified object type; otherwise, false. + /// + public override bool CanConvert(Type objectType) + { + return objectType == typeof(AppVersion); + } +} diff --git a/Pilz.Updating/Pilz.Updating.csproj b/Pilz.Updating/Pilz.Updating.csproj index 7fbc8eb..e0ad418 100644 --- a/Pilz.Updating/Pilz.Updating.csproj +++ b/Pilz.Updating/Pilz.Updating.csproj @@ -3,6 +3,7 @@ net8.0-windows enable + annotations diff --git a/Pilz.Updating/UpdateInfo.cs b/Pilz.Updating/UpdateInfo.cs index d1d4020..a4ebef1 100644 --- a/Pilz.Updating/UpdateInfo.cs +++ b/Pilz.Updating/UpdateInfo.cs @@ -4,7 +4,6 @@ namespace Pilz.Updating; public class UpdateInfo { - public string UpdateInstallerLink { get; set; } public List Packages { get; set; } = []; public static UpdateInfo Parse(string str) diff --git a/Pilz.Updating/UpdateInstaller/UpdateInstallerConfig.cs b/Pilz.Updating/UpdateInstaller/UpdateInstallerConfig.cs deleted file mode 100644 index 3fbda79..0000000 --- a/Pilz.Updating/UpdateInstaller/UpdateInstallerConfig.cs +++ /dev/null @@ -1,28 +0,0 @@ -using Newtonsoft.Json; - -namespace Pilz.Updating.UpdateInstaller; - -public class UpdateInstallerConfig -{ - public string PackagePath { get; set; } - public bool RestartHostApplication { get; set; } - public string RestartHostApplicationArguments { get; set; } - public string ApplicationName { get; set; } - public string HostApplicationPath { get; set; } - public string HostApplicationProcessPath { get; set; } - public bool ForceClosingHostApplication { get; set; } - public uint MillisecondsToWaitForHostApplicationToClose { get; set; } - public bool UIDarkMode { get; set; } - public ApplicationVersion CurrentApplicationVersion { get; set; } - public ApplicationVersion NewApplicationVersion { get; set; } - - public static UpdateInstallerConfig Parse(string str) - { - return JsonConvert.DeserializeObject(System.Text.Encoding.Default.GetString(Convert.FromBase64String(str))); - } - - public override string ToString() - { - return Convert.ToBase64String(System.Text.Encoding.Default.GetBytes(JsonConvert.SerializeObject(this))); - } -} \ No newline at end of file diff --git a/Pilz.Updating/UpdatePackageInfo.cs b/Pilz.Updating/UpdatePackageInfo.cs index 21f4bca..2af4147 100644 --- a/Pilz.Updating/UpdatePackageInfo.cs +++ b/Pilz.Updating/UpdatePackageInfo.cs @@ -3,7 +3,7 @@ public class UpdatePackageInfo { public string Name { get; set; } - public ApplicationVersion Version { get; set; } + public AppVersion Version { get; set; } public UpdateNotes Notes { get; } = new(); public string Packagelink { get; set; } } \ No newline at end of file