rework client and remove separated update installer (gui not finished yet)

This commit is contained in:
2024-06-26 17:24:08 +02:00
parent 5bc0c374cf
commit 07853467b1
68 changed files with 681 additions and 1462 deletions

View File

@@ -11,10 +11,14 @@
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<Compile Update="LangRes.Designer.cs"> <Compile Update="LangRes\GeneralLangRes.Designer.cs">
<DesignTime>True</DesignTime> <DesignTime>True</DesignTime>
<AutoGen>True</AutoGen> <AutoGen>True</AutoGen>
<DependentUpon>LangRes.resx</DependentUpon> <DependentUpon>GeneralLangRes.resx</DependentUpon>
</Compile>
<Compile Update="UpdateWindow.cs" />
<Compile Update="UpdateWindow.Designer.cs">
<SubType>Form</SubType>
</Compile> </Compile>
<Compile Update="SimpleActionDialog.Designer.cs"> <Compile Update="SimpleActionDialog.Designer.cs">
<DependentUpon>SimpleActionDialog.cs</DependentUpon> <DependentUpon>SimpleActionDialog.cs</DependentUpon>
@@ -22,12 +26,22 @@
<Compile Update="SimpleActionDialog.cs"> <Compile Update="SimpleActionDialog.cs">
<SubType>Form</SubType> <SubType>Form</SubType>
</Compile> </Compile>
<Compile Update="LangRes\UpdateInstallerLangRes.de.Designer.cs">
<DependentUpon>UpdateInstallerLangRes.de.resx</DependentUpon>
<DesignTime>True</DesignTime>
<AutoGen>True</AutoGen>
</Compile>
<Compile Update="LangRes\UpdateInstallerLangRes.Designer.cs">
<DependentUpon>UpdateInstallerLangRes.resx</DependentUpon>
<DesignTime>True</DesignTime>
<AutoGen>True</AutoGen>
</Compile>
<Compile Update="UpdatesAvailableDialog.cs" /> <Compile Update="UpdatesAvailableDialog.cs" />
<Compile Update="UpdatesAvailableDialog.Designer.cs"> <Compile Update="UpdatesAvailableDialog.Designer.cs">
<DependentUpon>UpdatesAvailableDialog.cs</DependentUpon> <DependentUpon>UpdatesAvailableDialog.cs</DependentUpon>
<SubType>Form</SubType> <SubType>Form</SubType>
</Compile> </Compile>
<Compile Update="UpdatingClientGuiLangRes.Designer.cs"> <Compile Update="LangRes\UpdatingClientGuiLangRes.Designer.cs">
<AutoGen>True</AutoGen> <AutoGen>True</AutoGen>
<DesignTime>True</DesignTime> <DesignTime>True</DesignTime>
<DependentUpon>UpdatingClientGuiLangRes.resx</DependentUpon> <DependentUpon>UpdatingClientGuiLangRes.resx</DependentUpon>
@@ -35,9 +49,9 @@
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<EmbeddedResource Update="LangRes.resx"> <EmbeddedResource Update="LangRes\GeneralLangRes.resx">
<Generator>ResXFileCodeGenerator</Generator> <Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>LangRes.Designer.cs</LastGenOutput> <LastGenOutput>GeneralLangRes.Designer.cs</LastGenOutput>
</EmbeddedResource> </EmbeddedResource>
<EmbeddedResource Update="SimpleActionDialog.de.resx"> <EmbeddedResource Update="SimpleActionDialog.de.resx">
<DependentUpon>SimpleActionDialog.cs</DependentUpon> <DependentUpon>SimpleActionDialog.cs</DependentUpon>
@@ -45,17 +59,27 @@
<EmbeddedResource Update="SimpleActionDialog.resx"> <EmbeddedResource Update="SimpleActionDialog.resx">
<DependentUpon>SimpleActionDialog.cs</DependentUpon> <DependentUpon>SimpleActionDialog.cs</DependentUpon>
</EmbeddedResource> </EmbeddedResource>
<EmbeddedResource Update="LangRes\UpdateInstallerLangRes.de.resx">
<CustomToolNamespace>Pilz.Updating.UpdateInstaller.My.Resources</CustomToolNamespace>
<LastGenOutput>UpdateInstallerLangRes.de.Designer.cs</LastGenOutput>
<Generator>ResXFileCodeGenerator</Generator>
</EmbeddedResource>
<EmbeddedResource Update="LangRes\UpdateInstallerLangRes.resx">
<CustomToolNamespace>Pilz.Updating.UpdateInstaller.My.Resources</CustomToolNamespace>
<LastGenOutput>UpdateInstallerLangRes.Designer.cs</LastGenOutput>
<Generator>ResXFileCodeGenerator</Generator>
</EmbeddedResource>
<EmbeddedResource Update="UpdatesAvailableDialog.de.resx"> <EmbeddedResource Update="UpdatesAvailableDialog.de.resx">
<DependentUpon>UpdatesAvailableDialog.cs</DependentUpon> <DependentUpon>UpdatesAvailableDialog.cs</DependentUpon>
</EmbeddedResource> </EmbeddedResource>
<EmbeddedResource Update="UpdatesAvailableDialog.resx"> <EmbeddedResource Update="UpdatesAvailableDialog.resx">
<DependentUpon>UpdatesAvailableDialog.cs</DependentUpon> <DependentUpon>UpdatesAvailableDialog.cs</DependentUpon>
</EmbeddedResource> </EmbeddedResource>
<EmbeddedResource Update="UpdatingClientGuiLangRes.de.resx"> <EmbeddedResource Update="LangRes\UpdatingClientGuiLangRes.de.resx">
<Generator></Generator> <Generator></Generator>
<CustomToolNamespace>Pilz.Updating.Client.GUI</CustomToolNamespace> <CustomToolNamespace>Pilz.Updating.Client.GUI</CustomToolNamespace>
</EmbeddedResource> </EmbeddedResource>
<EmbeddedResource Update="UpdatingClientGuiLangRes.resx"> <EmbeddedResource Update="LangRes\UpdatingClientGuiLangRes.resx">
<CustomToolNamespace>Pilz.Updating.Client.GUI</CustomToolNamespace> <CustomToolNamespace>Pilz.Updating.Client.GUI</CustomToolNamespace>
<Generator>ResXFileCodeGenerator</Generator> <Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>UpdatingClientGuiLangRes.Designer.cs</LastGenOutput> <LastGenOutput>UpdatingClientGuiLangRes.Designer.cs</LastGenOutput>
@@ -65,7 +89,6 @@
<ItemGroup> <ItemGroup>
<ProjectReference Include="..\Pilz.Updating.Client\Pilz.Updating.Client.csproj" /> <ProjectReference Include="..\Pilz.Updating.Client\Pilz.Updating.Client.csproj" />
<ProjectReference Include="..\Pilz.Updating.GUIBase\Pilz.Updating.GUIBase.csproj" /> <ProjectReference Include="..\Pilz.Updating.GUIBase\Pilz.Updating.GUIBase.csproj" />
<ProjectReference Include="..\Pilz.Updating.UpdateInstaller.Lib\Pilz.Updating.UpdateInstaller.Lib.csproj" />
<ProjectReference Include="..\Pilz.Updating\Pilz.Updating.csproj" /> <ProjectReference Include="..\Pilz.Updating\Pilz.Updating.csproj" />
</ItemGroup> </ItemGroup>

View File

@@ -1,7 +1,7 @@
using System.Diagnostics; using System.Diagnostics;
using System.Runtime.CompilerServices; using System.Runtime.CompilerServices;
namespace Pilz.Updating.Client.GUI namespace Pilz.Updating.Client.Gui
{ {
[Microsoft.VisualBasic.CompilerServices.DesignerGenerated()] [Microsoft.VisualBasic.CompilerServices.DesignerGenerated()]
public partial class SimpleActionDialog : Telerik.WinControls.UI.RadForm public partial class SimpleActionDialog : Telerik.WinControls.UI.RadForm

View File

@@ -1,4 +1,4 @@
namespace Pilz.Updating.Client.GUI; namespace Pilz.Updating.Client.Gui;
public partial class SimpleActionDialog public partial class SimpleActionDialog
{ {

View File

@@ -1,18 +1,19 @@
using Microsoft.VisualBasic.CompilerServices; using Pilz.UI;
using Pilz.UI;
using Pilz.UI.Telerik.Dialogs; using Pilz.UI.Telerik.Dialogs;
using Pilz.Updating.Client.Gui.LangRes;
using Pilz.Updating.Client.GUI;
using Pilz.Updating.GUIBase; using Pilz.Updating.GUIBase;
using System.ComponentModel; using System.ComponentModel;
using Telerik.WinControls; 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 // F i e l d s
private Form parentForm; private Form parentForm;
private SimpleActionDialog curProgressDialog; private UpdateWindow curProgressDialog;
private readonly UpdateClient updateClient; private readonly UpdateClient updateClient;
// P r o p e r t i e s // 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 // C o n s t r u c t o r s
public UpdateClientGUI(UpdateClient updateClient) public UpdateClientGui(UpdateClient updateClient)
{ {
this.updateClient = updateClient; this.updateClient = updateClient;
updateClient.UpdateStatusChanged += MyUpdateClient_UpdateStatusChanged; updateClient.OnStatusChanged += UpdateClient_OnStatusChanged;
updateClient.DownloadingUpdate += MyUpdateClient_DownloadingUpdate;
updateClient.InstallingUpdate += MyUpdateClient_InstallingUpdate;
updateClient.UpdateInstallerStarted += MyUpdateClient_FinishWork;
updateClient.NoUpdatesFound += MyUpdateClient_NoUpdatesFound;
} }
~UpdateClientGUI() ~UpdateClientGui()
{ {
updateClient.UpdateStatusChanged -= MyUpdateClient_UpdateStatusChanged; updateClient.OnStatusChanged -= UpdateClient_OnStatusChanged;
updateClient.DownloadingUpdate -= MyUpdateClient_DownloadingUpdate;
updateClient.InstallingUpdate -= MyUpdateClient_InstallingUpdate;
updateClient.UpdateInstallerStarted -= MyUpdateClient_FinishWork;
updateClient.NoUpdatesFound -= MyUpdateClient_NoUpdatesFound;
} }
// F e a t u r e s // F e a t u r e s
@@ -52,33 +45,81 @@ public class UpdateClientGUI
private void EndUpdating() 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; void setStatus()
if (!(newStatus == UpdateStatus.Searching && UseHiddenSearch)) {
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; useGui = true;
} }
if (useGui && curProgressDialog is null) if (useGui && curProgressDialog is null)
{ {
parentForm.Invoke(new Action(() => parentForm.Invoke(() =>
{ {
curProgressDialog = new SimpleActionDialog(); curProgressDialog = new UpdateWindow();
curProgressDialog.SetCurrentState(UpdateStatus.Waiting); curProgressDialog.SetStatus(UpdateStatus.Waiting);
curProgressDialog.Show(parentForm); 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); var dres = default(DialogResult);
bool cancel;
// Hide progress dialog // Hide progress dialog
curProgressDialog?.Invoke(new Action(curProgressDialog.Hide)); curProgressDialog?.Invoke(new Action(curProgressDialog.Hide));
@@ -97,38 +138,22 @@ public class UpdateClientGUI
pkg.Notes, pkg.Notes,
updateClient.InstallAsAdmin); updateClient.InstallAsAdmin);
var symbol = GlobalSymbolFactory.Instance.GetImage(GlobalSymbols.software_installer, UI.Telerik.SvgImageSize.Small).ToIcon(); 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) if (dres != DialogResult.OK)
{ {
// Finish updating // Cancel
e.Cancel = true; cancel = true;
EndUpdating(); EndUpdating();
} }
else else
{ {
// Cancel // Continue
e.Cancel = false; cancel = false;
curProgressDialog?.Invoke(new Action(curProgressDialog.Show)); curProgressDialog?.Invoke(new Action(curProgressDialog.Show));
} }
}
private void MyUpdateClient_InstallingUpdate(UpdatePackageInfo pkg, CancelEventArgs e) return cancel;
{
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);
} }
} }

View File

@@ -8,7 +8,7 @@
// </auto-generated> // </auto-generated>
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
namespace Pilz.Updating.Client.GUI { namespace Pilz.Updating.Client.Gui.LangRes {
using System; 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.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "17.0.0.0")]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
internal class LangRes { internal class GeneralLangRes {
private static global::System.Resources.ResourceManager resourceMan; private static global::System.Resources.ResourceManager resourceMan;
private static global::System.Globalization.CultureInfo resourceCulture; private static global::System.Globalization.CultureInfo resourceCulture;
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
internal LangRes() { internal GeneralLangRes() {
} }
/// <summary> /// <summary>
@@ -39,7 +39,7 @@ namespace Pilz.Updating.Client.GUI {
internal static global::System.Resources.ResourceManager ResourceManager { internal static global::System.Resources.ResourceManager ResourceManager {
get { get {
if (object.ReferenceEquals(resourceMan, null)) { 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; resourceMan = temp;
} }
return resourceMan; return resourceMan;

View File

@@ -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.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "17.0.0.0")]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
internal class UpdateInstallerGuiLangRes { internal class UpdateInstallerLangRes {
private static global::System.Resources.ResourceManager resourceMan; private static global::System.Resources.ResourceManager resourceMan;
private static global::System.Globalization.CultureInfo resourceCulture; private static global::System.Globalization.CultureInfo resourceCulture;
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
internal UpdateInstallerGuiLangRes() { internal UpdateInstallerLangRes() {
} }
/// <summary> /// <summary>
@@ -39,7 +39,7 @@ namespace Pilz.Updating.UpdateInstaller.My.Resources {
internal static global::System.Resources.ResourceManager ResourceManager { internal static global::System.Resources.ResourceManager ResourceManager {
get { get {
if (object.ReferenceEquals(resourceMan, null)) { 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; resourceMan = temp;
} }
return resourceMan; return resourceMan;

View File

@@ -39,7 +39,7 @@ namespace Pilz.Updating.Client.GUI {
internal static global::System.Resources.ResourceManager ResourceManager { internal static global::System.Resources.ResourceManager ResourceManager {
get { get {
if (object.ReferenceEquals(resourceMan, null)) { 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; resourceMan = temp;
} }
return resourceMan; return resourceMan;

View File

@@ -1,11 +1,9 @@
<Project Sdk="Microsoft.NET.Sdk"> <Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup> <PropertyGroup>
<OutputType>WinExe</OutputType>
<TargetFrameworks>net8.0-windows</TargetFrameworks> <TargetFrameworks>net8.0-windows</TargetFrameworks>
<UseWindowsForms>true</UseWindowsForms> <UseWindowsForms>true</UseWindowsForms>
<ImplicitUsings>enable</ImplicitUsings> <ImplicitUsings>enable</ImplicitUsings>
<GeneratePackageOnBuild>false</GeneratePackageOnBuild>
</PropertyGroup> </PropertyGroup>
<PropertyGroup> <PropertyGroup>
@@ -13,96 +11,109 @@
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<Compile Update="Main.cs" /> <Compile Update="LangRes.Designer.cs">
<Compile Update="Main.Designer.cs"> <DesignTime>True</DesignTime>
<DependentUpon>Main.cs</DependentUpon> <AutoGen>True</AutoGen>
<DependentUpon>LangRes.resx</DependentUpon>
</Compile>
<Compile Update="UpdateInstallerWindow.cs">
<SubType>Form</SubType> <SubType>Form</SubType>
</Compile> </Compile>
<Compile Update="MyIcons.Designer.cs"> <Compile Update="UpdateInstallerWindow.Designer.cs">
<DesignTime>True</DesignTime> <SubType>Form</SubType>
<AutoGen>True</AutoGen>
<DependentUpon>MyIcons.resx</DependentUpon>
</Compile> </Compile>
<Compile Update="Properties\Resources.Designer.cs"> <Compile Update="SimpleActionDialog.Designer.cs">
<AutoGen>True</AutoGen> <DependentUpon>SimpleActionDialog.cs</DependentUpon>
<DesignTime>True</DesignTime>
<DependentUpon>Resources.resx</DependentUpon>
</Compile> </Compile>
<Compile Update="Properties\Settings.Designer.cs"> <Compile Update="SimpleActionDialog.cs">
<AutoGen>True</AutoGen> <SubType>Form</SubType>
<DependentUpon>Settings.settings</DependentUpon>
<DesignTimeSharedInput>True</DesignTimeSharedInput>
</Compile> </Compile>
<Compile Update="UpdateInstallerGuiLangRes.de.Designer.cs"> <Compile Update="UpdateInstallerGuiLangRes.de.Designer.cs">
<DependentUpon>UpdateInstallerGuiLangRes.de.resx</DependentUpon> <DependentUpon>UpdateInstallerGuiLangRes.de.resx</DependentUpon>
<AutoGen>True</AutoGen>
<DesignTime>True</DesignTime> <DesignTime>True</DesignTime>
<AutoGen>True</AutoGen>
</Compile> </Compile>
<Compile Update="UpdateInstallerGuiLangRes.Designer.cs"> <Compile Update="UpdateInstallerGuiLangRes.Designer.cs">
<DependentUpon>UpdateInstallerGuiLangRes.resx</DependentUpon>
<DesignTime>True</DesignTime>
<AutoGen>True</AutoGen>
</Compile>
<Compile Update="UpdatesAvailableDialog.cs" />
<Compile Update="UpdatesAvailableDialog.Designer.cs">
<DependentUpon>UpdatesAvailableDialog.cs</DependentUpon>
<SubType>Form</SubType>
</Compile>
<Compile Update="UpdatingClientGuiLangRes.Designer.cs">
<AutoGen>True</AutoGen> <AutoGen>True</AutoGen>
<DesignTime>True</DesignTime> <DesignTime>True</DesignTime>
<DependentUpon>UpdateInstallerGuiLangRes.resx</DependentUpon> <DependentUpon>UpdatingClientGuiLangRes.resx</DependentUpon>
</Compile> </Compile>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<EmbeddedResource Update="LangRes.resx">
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>LangRes.Designer.cs</LastGenOutput>
</EmbeddedResource>
<EmbeddedResource Update="Main.resx"> <EmbeddedResource Update="Main.resx">
<DependentUpon>Main.cs</DependentUpon> <DependentUpon>Main.cs</DependentUpon>
</EmbeddedResource> </EmbeddedResource>
<EmbeddedResource Update="MyIcons.resx"> <EmbeddedResource Update="SimpleActionDialog.de.resx">
<Generator>ResXFileCodeGenerator</Generator> <DependentUpon>SimpleActionDialog.cs</DependentUpon>
<LastGenOutput>MyIcons.Designer.cs</LastGenOutput>
</EmbeddedResource> </EmbeddedResource>
<EmbeddedResource Update="Properties\Resources.resx"> <EmbeddedResource Update="SimpleActionDialog.resx">
<Generator>ResXFileCodeGenerator</Generator> <DependentUpon>SimpleActionDialog.cs</DependentUpon>
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
<CustomToolNamespace>Pilz.Updating.UpdateInstaller.My.Resources</CustomToolNamespace>
<SubType>Designer</SubType>
</EmbeddedResource> </EmbeddedResource>
<EmbeddedResource Update="UpdateInstallerGuiLangRes.de.resx"> <EmbeddedResource Update="UpdateInstallerGuiLangRes.de.resx">
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>UpdateInstallerGuiLangRes.de.Designer.cs</LastGenOutput>
<CustomToolNamespace>Pilz.Updating.UpdateInstaller.My.Resources</CustomToolNamespace> <CustomToolNamespace>Pilz.Updating.UpdateInstaller.My.Resources</CustomToolNamespace>
<LastGenOutput>UpdateInstallerGuiLangRes.de.Designer.cs</LastGenOutput>
<Generator>ResXFileCodeGenerator</Generator>
</EmbeddedResource> </EmbeddedResource>
<EmbeddedResource Update="UpdateInstallerGuiLangRes.resx"> <EmbeddedResource Update="UpdateInstallerGuiLangRes.resx">
<CustomToolNamespace>Pilz.Updating.UpdateInstaller.My.Resources</CustomToolNamespace> <CustomToolNamespace>Pilz.Updating.UpdateInstaller.My.Resources</CustomToolNamespace>
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>UpdateInstallerGuiLangRes.Designer.cs</LastGenOutput> <LastGenOutput>UpdateInstallerGuiLangRes.Designer.cs</LastGenOutput>
<Generator>ResXFileCodeGenerator</Generator>
</EmbeddedResource>
<EmbeddedResource Update="UpdatesAvailableDialog.de.resx">
<DependentUpon>UpdatesAvailableDialog.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Update="UpdatesAvailableDialog.resx">
<DependentUpon>UpdatesAvailableDialog.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Update="UpdatingClientGuiLangRes.de.resx">
<Generator></Generator>
<CustomToolNamespace>Pilz.Updating.Client.GUI</CustomToolNamespace>
</EmbeddedResource>
<EmbeddedResource Update="UpdatingClientGuiLangRes.resx">
<CustomToolNamespace>Pilz.Updating.Client.GUI</CustomToolNamespace>
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>UpdatingClientGuiLangRes.Designer.cs</LastGenOutput>
</EmbeddedResource> </EmbeddedResource>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<None Include="Properties\Settings.settings"> <ProjectReference Include="..\Pilz.Updating.Client\Pilz.Updating.Client.csproj" />
<Generator>SettingsSingleFileGenerator</Generator> <ProjectReference Include="..\Pilz.Updating.GUIBase\Pilz.Updating.GUIBase.csproj" />
<CustomToolNamespace>Pilz.Updating.UpdateInstaller.My</CustomToolNamespace>
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
</None>
</ItemGroup>
<ItemGroup>
<Content Include="icons8_software_installer.ico" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Pilz.Updating.UpdateInstaller.Lib\Pilz.Updating.UpdateInstaller.Lib.csproj" />
<ProjectReference Include="..\Pilz.Updating\Pilz.Updating.csproj" /> <ProjectReference Include="..\Pilz.Updating\Pilz.Updating.csproj" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="Microsoft.VisualBasic" Version="10.3.0" /> <PackageReference Include="Microsoft.VisualBasic" Version="10.3.0" />
<PackageReference Include="Pilz.IO" Version="2.0.0" /> <PackageReference Include="Pilz.IO" Version="2.0.0" />
<PackageReference Include="Pilz.Plugins" Version="2.1.9" /> <PackageReference Include="Pilz.UI.Telerik" Version="2.5.2" />
<PackageReference Include="System.IO.Compression" Version="4.3.0" /> <PackageReference Include="Pilz.UI.Telerik.SymbolFactory" Version="2.0.4" />
<PackageReference Include="System.Data.DataSetExtensions" Version="4.5.0" /> <PackageReference Include="System.Data.DataSetExtensions" Version="4.5.0" />
<PackageReference Include="System.Net.Http" Version="4.3.4" /> <PackageReference Include="System.Net.Http" Version="4.3.4" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" /> <PackageReference Include="Markdig" Version="0.37.0" />
<PackageReference Include="UI.for.WinForms.Common" Version="2024.2.514" /> <PackageReference Include="System.Runtime.CompilerServices.Unsafe" Version="6.0.0" />
<PackageReference Include="UI.for.WinForms.Themes" Version="2024.2.514" /> <PackageReference Include="UI.for.WinForms.Common" Version="2024.2.514" PrivateAssets="all" />
<PackageReference Include="Z.ExtensionMethods.WithNamespace" Version="2.1.1" /> <PackageReference Include="UI.for.WinForms.RichTextEditor" Version="2024.2.514" PrivateAssets="all" />
<PackageReference Include="Westermo.HtmlRenderer.WinForms" Version="1.7.0" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Import Include="Microsoft.VisualBasic" /> <Import Include="Microsoft.VisualBasic" />
<Import Include="SM64_ROM_Manager.Updating.GUIBase" />
<Import Include="System" /> <Import Include="System" />
<Import Include="System.Collections" /> <Import Include="System.Collections" />
<Import Include="System.Collections.Generic" /> <Import Include="System.Collections.Generic" />
@@ -113,7 +124,6 @@
<Import Include="System.Linq" /> <Import Include="System.Linq" />
<Import Include="System.Xml.Linq" /> <Import Include="System.Xml.Linq" />
<Import Include="System.Threading.Tasks" /> <Import Include="System.Threading.Tasks" />
<Import Include="Z.IO.Extensions" />
</ItemGroup> </ItemGroup>
</Project> </Project>

View File

@@ -1,11 +1,10 @@
using Microsoft.VisualBasic.CompilerServices; using Microsoft.VisualBasic.CompilerServices;
using System.Diagnostics; using System.Diagnostics;
using System.Runtime.CompilerServices;
namespace Pilz.Updating.UpdateInstaller namespace Pilz.Updating.Client.Gui
{ {
[DesignerGenerated()] [DesignerGenerated()]
public partial class Main : Telerik.WinControls.UI.RadForm public partial class UpdateWindow
{ {
// Das Formular überschreibt den Löschvorgang, um die Komponentenliste zu bereinigen. // Das Formular überschreibt den Löschvorgang, um die Komponentenliste zu bereinigen.
@@ -34,13 +33,13 @@ namespace Pilz.Updating.UpdateInstaller
[DebuggerStepThrough()] [DebuggerStepThrough()]
private void InitializeComponent() private void InitializeComponent()
{ {
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(Main)); System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(UpdateWindow));
_Panel1 = new Panel(); panel1 = new Panel();
radWaitingBar1 = new Telerik.WinControls.UI.RadWaitingBar(); radWaitingBar1 = new Telerik.WinControls.UI.RadWaitingBar();
dotsLineWaitingBarIndicatorElement1 = new Telerik.WinControls.UI.DotsLineWaitingBarIndicatorElement(); dotsLineWaitingBarIndicatorElement1 = new Telerik.WinControls.UI.DotsLineWaitingBarIndicatorElement();
radLabel_Status = new Telerik.WinControls.UI.RadLabel(); radLabel_Status = new Telerik.WinControls.UI.RadLabel();
radLabel_Header = new Telerik.WinControls.UI.RadLabel(); radLabel_Header = new Telerik.WinControls.UI.RadLabel();
_Panel1.SuspendLayout(); panel1.SuspendLayout();
((System.ComponentModel.ISupportInitialize)radWaitingBar1).BeginInit(); ((System.ComponentModel.ISupportInitialize)radWaitingBar1).BeginInit();
((System.ComponentModel.ISupportInitialize)radLabel_Status).BeginInit(); ((System.ComponentModel.ISupportInitialize)radLabel_Status).BeginInit();
((System.ComponentModel.ISupportInitialize)radLabel_Header).BeginInit(); ((System.ComponentModel.ISupportInitialize)radLabel_Header).BeginInit();
@@ -49,15 +48,15 @@ namespace Pilz.Updating.UpdateInstaller
// //
// _Panel1 // _Panel1
// //
_Panel1.BackColor = Color.Transparent; panel1.BackColor = Color.Transparent;
_Panel1.Controls.Add(radWaitingBar1); panel1.Controls.Add(radWaitingBar1);
_Panel1.Controls.Add(radLabel_Status); panel1.Controls.Add(radLabel_Status);
_Panel1.Controls.Add(radLabel_Header); panel1.Controls.Add(radLabel_Header);
_Panel1.Dock = DockStyle.Fill; panel1.Dock = DockStyle.Fill;
_Panel1.Location = new Point(0, 0); panel1.Location = new Point(0, 0);
_Panel1.Name = "_Panel1"; panel1.Name = "_Panel1";
_Panel1.Size = new Size(692, 87); panel1.Size = new Size(692, 87);
_Panel1.TabIndex = 1; panel1.TabIndex = 1;
// //
// radWaitingBar1 // radWaitingBar1
// //
@@ -94,7 +93,6 @@ namespace Pilz.Updating.UpdateInstaller
// //
radLabel_Header.Anchor = AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right; radLabel_Header.Anchor = AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right;
radLabel_Header.AutoSize = false; radLabel_Header.AutoSize = false;
radLabel_Header.Image = MyIcons.icons8_installing_updates_48px;
radLabel_Header.Location = new Point(3, 3); radLabel_Header.Location = new Point(3, 3);
radLabel_Header.Name = "radLabel_Header"; radLabel_Header.Name = "radLabel_Header";
radLabel_Header.Size = new Size(686, 57); radLabel_Header.Size = new Size(686, 57);
@@ -109,7 +107,7 @@ namespace Pilz.Updating.UpdateInstaller
AutoScaleDimensions = new SizeF(7F, 15F); AutoScaleDimensions = new SizeF(7F, 15F);
AutoScaleMode = AutoScaleMode.Font; AutoScaleMode = AutoScaleMode.Font;
ClientSize = new Size(692, 87); ClientSize = new Size(692, 87);
Controls.Add(_Panel1); Controls.Add(panel1);
FormBorderStyle = FormBorderStyle.FixedSingle; FormBorderStyle = FormBorderStyle.FixedSingle;
Icon = (Icon)resources.GetObject("$this.Icon"); Icon = (Icon)resources.GetObject("$this.Icon");
MaximizeBox = false; MaximizeBox = false;
@@ -117,7 +115,7 @@ namespace Pilz.Updating.UpdateInstaller
Name = "Main"; Name = "Main";
StartPosition = FormStartPosition.CenterScreen; StartPosition = FormStartPosition.CenterScreen;
Text = "Installing"; Text = "Installing";
_Panel1.ResumeLayout(false); panel1.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)radWaitingBar1).EndInit(); ((System.ComponentModel.ISupportInitialize)radWaitingBar1).EndInit();
((System.ComponentModel.ISupportInitialize)radLabel_Status).EndInit(); ((System.ComponentModel.ISupportInitialize)radLabel_Status).EndInit();
((System.ComponentModel.ISupportInitialize)radLabel_Header).EndInit(); ((System.ComponentModel.ISupportInitialize)radLabel_Header).EndInit();
@@ -125,32 +123,10 @@ namespace Pilz.Updating.UpdateInstaller
ResumeLayout(false); ResumeLayout(false);
} }
private Panel _Panel1; private Panel panel1;
private Telerik.WinControls.UI.RadLabel radLabel_Status; private Telerik.WinControls.UI.RadLabel radLabel_Status;
private Telerik.WinControls.UI.RadLabel radLabel_Header; private Telerik.WinControls.UI.RadLabel radLabel_Header;
private Telerik.WinControls.UI.RadWaitingBar radWaitingBar1; private Telerik.WinControls.UI.RadWaitingBar radWaitingBar1;
private Telerik.WinControls.UI.DotsLineWaitingBarIndicatorElement dotsLineWaitingBarIndicatorElement1; 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)
{
}
}
}
} }
} }

View File

@@ -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 = $"<html><span style=\"font-size: 18pt; color: #b7472a\"><b>{header}</b></span></html>";
}
// 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)));
}
}

View File

@@ -0,0 +1,4 @@
namespace Pilz.Updating.Client;
public delegate void UpdateClientEventHandler(object sender, UpdateClientEventArgs e);
public delegate void UpdateClientStatusChangedEventHandler(object sender, UpdateStatusEventArgs e);

View File

@@ -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);
}
}
}

View File

@@ -1,97 +1,72 @@
using Pilz.Updating.UpdateInstaller; using System.ComponentModel;
using System.ComponentModel; using System.Configuration;
using System.Diagnostics; using System.Diagnostics;
using System.IO.Compression; 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 UpdateClientStatusChangedEventHandler OnStatusChanged;
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();
// F i e l d s // F i e l d s
private readonly Dictionary<UpdatePackageInfo, string> dicPackagePaths = []; private readonly Dictionary<UpdatePackageInfo, string> dicPackagePaths = [];
private UpdateStatus curDownloadingStatus = UpdateStatus.Waiting;
// P r o p e r t i e s // P r o p e r t i e s
public HttpClient WebClient { get; private set; } = new(); public HttpClient WebClient { get; private set; } = new();
public string UpdateUrl { get; private set; } = updateUrl; 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 Channels MinimumChannel { get; private set; } = (Channels)Math.Max((int)minimumChannel, (int)currentVersion.Channel);
public UpdateInfo UpdateInfo { get; private set; } = null; public UpdateInfo UpdateInfo { get; private set; } = null;
public UpdatePackageInfo UpdatePackageInfo { get; private set; } = null; public UpdatePackageInfo UpdatePackageInfo { get; private set; } = null;
public bool AutoCloseHostApplication { get; set; } = false; public bool AutoCloseHostApplication { get; set; } = false;
public bool AutoRestartHostApplication { get; set; } = false;
public string RestartHostApplicationArguments { get; set; } public string RestartHostApplicationArguments { get; set; }
public string HostApplicationPath { get; set; } = string.Empty; public string HostApplicationPath { get; set; } = string.Empty;
public string ApplicationName { get; set; } = string.Empty; public string ApplicationName { get; set; } = string.Empty;
public bool InstallAsAdmin { get; set; } = false; 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 UIDarkMode { get; set; } = false;
public bool HasUpdates => UpdatePackageInfo != null;
// E v e n t M e t h o d s // 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); RaiseStatusChanged(status, UpdateStatusEvent.Default);
DownloadingUpdate?.Invoke(pkg, e);
return e.Cancel;
} }
private bool RaiseInstallingUpdate(UpdatePackageInfo pkg) private void RaiseStatusChanged(UpdateStatus status, UpdateStatusEvent statusEvent)
{ {
var e = new CancelEventArgs(true); RaiseStatusChanged(status, statusEvent, false);
InstallingUpdate?.Invoke(pkg, e);
return e.Cancel;
} }
// 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() public async Task UpdateInteractive()
{ {
var latestVersion = await CheckForUpdate(); var latestVersion = await CheckForUpdate();
if (latestVersion is null)
NoUpdatesFound?.Invoke(); if (HasUpdates)
else
await UpdateInteractive(latestVersion); await UpdateInteractive(latestVersion);
} }
public async Task UpdateInteractive(UpdatePackageInfo package) public async Task UpdateInteractive(UpdatePackageInfo package)
{ {
if (!RaiseDownloadingUpdate(package) && await DownloadPackageAsync(package)) if (await DownloadPackageAsync(package))
{ await InstallPackageAsync(package);
if (!RaiseInstallingUpdate(package))
await InstallPackage(package);
}
}
public void RaiseUpdateStatusChanged(UpdateStatus newStatus)
{
UpdateStatusChanged?.Invoke(newStatus);
} }
// F e a t u r e s // F e a t u r e s
@@ -103,21 +78,23 @@ public class UpdateClient(string updateUrl, ApplicationVersion currentVersion, C
return info; return info;
} }
public async Task<UpdatePackageInfo> CheckForUpdate() private async Task<UpdatePackageInfo> CheckForUpdate()
{ {
RaiseUpdateStatusChanged(UpdateStatus.Searching); RaiseStatusChanged(UpdateStatus.Searching, UpdateStatusEvent.PreEvent);
UpdateInfo = await GetUpdateInfo(); UpdateInfo = await GetUpdateInfo();
if (UpdateInfo is not null)
return CheckForUpdate(UpdateInfo); if (UpdateInfo is null)
else
return null; return null;
return CheckForUpdate(UpdateInfo);
} }
public UpdatePackageInfo CheckForUpdate(UpdateInfo updateInfo) private UpdatePackageInfo CheckForUpdate(UpdateInfo updateInfo)
{ {
UpdatePackageInfo foundPkgInfo = null; UpdatePackageInfo foundPkgInfo = null;
var latestVersion = CurrentVersion; var latestVersion = CurrentVersion;
RaiseUpdateStatusChanged(UpdateStatus.Searching);
foreach (UpdatePackageInfo pkgInfo in updateInfo.Packages) foreach (UpdatePackageInfo pkgInfo in updateInfo.Packages)
{ {
if (pkgInfo.Version.Channel <= MinimumChannel && pkgInfo.Version > latestVersion) if (pkgInfo.Version.Channel <= MinimumChannel && pkgInfo.Version > latestVersion)
@@ -128,13 +105,20 @@ public class UpdateClient(string updateUrl, ApplicationVersion currentVersion, C
} }
UpdatePackageInfo = foundPkgInfo; UpdatePackageInfo = foundPkgInfo;
if (!RaiseStatusChanged(UpdateStatus.Searching, UpdateStatusEvent.PostEvent, true))
{
UpdatePackageInfo = null;
return null;
}
return foundPkgInfo; return foundPkgInfo;
} }
public async Task<bool> DownloadPackageAsync(UpdatePackageInfo package) public async Task<bool> DownloadPackageAsync(UpdatePackageInfo package)
{ {
curDownloadingStatus = UpdateStatus.DownloadingPackage; RaiseStatusChanged(UpdateStatus.Downloading, UpdateStatusEvent.PreEvent);
RaiseUpdateStatusChanged(curDownloadingStatus);
var dirPath = Path.Combine(MyPaths.GetMyAppDataPath(), package.GetHashCode().ToString()); var dirPath = Path.Combine(MyPaths.GetMyAppDataPath(), package.GetHashCode().ToString());
var zipPath = Path.Combine(dirPath, "package.zip"); var zipPath = Path.Combine(dirPath, "package.zip");
var dir = new DirectoryInfo(dirPath); var dir = new DirectoryInfo(dirPath);
@@ -159,88 +143,57 @@ public class UpdateClient(string updateUrl, ApplicationVersion currentVersion, C
return false; return false;
} }
return true; if (!RaiseStatusChanged(UpdateStatus.Downloading, UpdateStatusEvent.PostEvent, true))
}
private async Task<FileInfo> DownloadUpdateInstaller()
{ {
curDownloadingStatus = UpdateStatus.DownloadingInstaller; RaiseStatusChanged(UpdateStatus.Canceled);
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))
{
using var installerZipStream = await WebClient.GetStreamAsync(UpdateInfo.UpdateInstallerLink);
await installerZipStream.CopyToAsync(installerZipFile);
}
// Extract update installer
var installerExtractPath = installerDirPath.CreateSubdirectory("extracted");
ZipFile.ExtractToDirectory(installerZipPath, installerExtractPath.FullName);
File.Delete(installerZipPath);
// Get UpdateInstaller.exe file
return installerExtractPath.EnumerateFiles("*.exe").FirstOrDefault();
}
private void StartUpdateInstaller(string packagePath, string installerPath)
{
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<bool> 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 false;
} }
return true;
}
private void InstallPackage(UpdatePackageInfo package)
{
// Extract Package
if (!RaiseStatusChanged(UpdateStatus.Extracting, UpdateStatusEvent.PreEvent, true))
{
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);
// 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);
// 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);
}
public Task InstallPackageAsync(UpdatePackageInfo package)
{
return Task.Run(() => InstallPackage(package));
}
} }

View File

@@ -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;
}

View File

@@ -1,10 +1,14 @@
namespace Pilz.Updating; namespace Pilz.Updating.Client;
public enum UpdateStatus public enum UpdateStatus
{ {
Waiting, Waiting,
Searching, Searching,
DownloadingPackage, Downloading,
DownloadingInstaller, Extracting,
StartingInstaller Copying,
Cleanup,
Done,
Failed,
Canceled,
} }

View File

@@ -0,0 +1,8 @@
namespace Pilz.Updating.Client;
public enum UpdateStatusEvent
{
Default,
PreEvent,
PostEvent
}

View File

@@ -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; }
}

View File

@@ -0,0 +1,5 @@
namespace Pilz.Updating.Client;
public static class Utils
{
}

View File

@@ -1,18 +0,0 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>net8.0-windows</TargetFrameworks>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
<PropertyGroup>
<Version>3.0.0</Version>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\Pilz.Updating.Client\Pilz.Updating.Client.csproj" />
<ProjectReference Include="..\Pilz.Updating\Pilz.Updating.csproj" />
</ItemGroup>
</Project>

View File

@@ -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);
}
}

View File

@@ -1,6 +0,0 @@
namespace Pilz.Updating.UpdateInstaller.Lib;
public class UpdateInstallerEventArgs(UpdateInstaller updateInstaller) : EventArgs
{
public UpdateInstaller UpdateInstaller { get; init; } = updateInstaller;
}

View File

@@ -1,11 +0,0 @@
namespace Pilz.Updating.UpdateInstaller.Lib;
public enum UpdateInstallerStatus
{
Waiting,
Extracting,
CopyingFiles,
RemovingFiles,
Done
}

View File

@@ -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;
}
}

View File

@@ -1,10 +0,0 @@
namespace Pilz.Updating.UpdateInstaller.Lib;
public enum UpdateInstallerStep
{
Startup,
ExtractPackage,
CopyFiles,
DeletePackage,
Finish
}

View File

@@ -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;
}
}

View File

@@ -1,8 +0,0 @@
namespace Pilz.Updating.UpdateInstaller.Lib;
public enum UpdateInstallerStepState
{
Default,
PreEvent,
PostEvent
}

View File

@@ -1,9 +0,0 @@
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.7.2" />
</startup>
<appSettings>
<add key="TelerikWinFormsThemeName" value="Fluent" />
</appSettings>
</configuration>

View File

@@ -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);
}
}
}
}

View File

@@ -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 = $"<html><span style=\"font-size: 18pt; color: #b7472a\"><b>{header}</b></span></html>";
}
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)));
}
}

View File

@@ -1,203 +0,0 @@
//------------------------------------------------------------------------------
// <auto-generated>
// 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.
// </auto-generated>
//------------------------------------------------------------------------------
namespace Pilz.Updating.UpdateInstaller {
using System;
/// <summary>
/// Eine stark typisierte Ressourcenklasse zum Suchen von lokalisierten Zeichenfolgen usw.
/// </summary>
// 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() {
}
/// <summary>
/// Gibt die zwischengespeicherte ResourceManager-Instanz zurück, die von dieser Klasse verwendet wird.
/// </summary>
[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;
}
}
/// <summary>
/// Überschreibt die CurrentUICulture-Eigenschaft des aktuellen Threads für alle
/// Ressourcenzuordnungen, die diese stark typisierte Ressourcenklasse verwenden.
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Globalization.CultureInfo Culture {
get {
return resourceCulture;
}
set {
resourceCulture = value;
}
}
/// <summary>
/// Sucht eine lokalisierte Ressource vom Typ System.Drawing.Bitmap.
/// </summary>
internal static System.Drawing.Bitmap icons8_checkmark_16px {
get {
object obj = ResourceManager.GetObject("icons8_checkmark_16px", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
/// <summary>
/// Sucht eine lokalisierte Ressource vom Typ System.Drawing.Bitmap.
/// </summary>
internal static System.Drawing.Bitmap icons8_console_16px_1 {
get {
object obj = ResourceManager.GetObject("icons8_console_16px_1", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
/// <summary>
/// Sucht eine lokalisierte Ressource vom Typ System.Drawing.Bitmap.
/// </summary>
internal static System.Drawing.Bitmap icons8_copy_16px {
get {
object obj = ResourceManager.GetObject("icons8_copy_16px", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
/// <summary>
/// Sucht eine lokalisierte Ressource vom Typ System.Drawing.Bitmap.
/// </summary>
internal static System.Drawing.Bitmap icons8_installing_updates_12px {
get {
object obj = ResourceManager.GetObject("icons8_installing_updates_12px", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
/// <summary>
/// Sucht eine lokalisierte Ressource vom Typ System.Drawing.Bitmap.
/// </summary>
internal static System.Drawing.Bitmap icons8_installing_updates_16px {
get {
object obj = ResourceManager.GetObject("icons8_installing_updates_16px", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
/// <summary>
/// Sucht eine lokalisierte Ressource vom Typ System.Drawing.Bitmap.
/// </summary>
internal static System.Drawing.Bitmap icons8_installing_updates_32px {
get {
object obj = ResourceManager.GetObject("icons8_installing_updates_32px", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
/// <summary>
/// Sucht eine lokalisierte Ressource vom Typ System.Drawing.Bitmap.
/// </summary>
internal static System.Drawing.Bitmap icons8_installing_updates_48px {
get {
object obj = ResourceManager.GetObject("icons8_installing_updates_48px", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
/// <summary>
/// Sucht eine lokalisierte Ressource vom Typ System.Drawing.Bitmap.
/// </summary>
internal static System.Drawing.Bitmap icons8_open_archive_16px {
get {
object obj = ResourceManager.GetObject("icons8_open_archive_16px", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
/// <summary>
/// Sucht eine lokalisierte Ressource vom Typ System.Drawing.Bitmap.
/// </summary>
internal static System.Drawing.Bitmap icons8_recycle_bin_16px {
get {
object obj = ResourceManager.GetObject("icons8_recycle_bin_16px", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
/// <summary>
/// Sucht eine lokalisierte Ressource vom Typ System.Drawing.Bitmap.
/// </summary>
internal static System.Drawing.Bitmap icons8_sand_timer_16px {
get {
object obj = ResourceManager.GetObject("icons8_sand_timer_16px", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
/// <summary>
/// Sucht eine lokalisierte Ressource vom Typ System.Drawing.Bitmap.
/// </summary>
internal static System.Drawing.Bitmap icons8_uninstalling_updates_12px {
get {
object obj = ResourceManager.GetObject("icons8_uninstalling_updates_12px", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
/// <summary>
/// Sucht eine lokalisierte Ressource vom Typ System.Drawing.Bitmap.
/// </summary>
internal static System.Drawing.Bitmap icons8_uninstalling_updates_16px {
get {
object obj = ResourceManager.GetObject("icons8_uninstalling_updates_16px", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
/// <summary>
/// Sucht eine lokalisierte Ressource vom Typ System.Drawing.Bitmap.
/// </summary>
internal static System.Drawing.Bitmap icons8_uninstalling_updates_32px {
get {
object obj = ResourceManager.GetObject("icons8_uninstalling_updates_32px", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
/// <summary>
/// Sucht eine lokalisierte Ressource vom Typ System.Drawing.Bitmap.
/// </summary>
internal static System.Drawing.Bitmap icons8_uninstalling_updates_48px {
get {
object obj = ResourceManager.GetObject("icons8_uninstalling_updates_48px", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
}
}

View File

@@ -1,163 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<assembly alias="System.Windows.Forms" name="System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
<data name="icons8_checkmark_16px" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>Resources\icons8_checkmark_16px.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="icons8_console_16px_1" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>Resources\icons8_console_16px_1.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="icons8_copy_16px" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>Resources\icons8_copy_16px.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="icons8_installing_updates_12px" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>Resources\icons8_installing_updates_12px.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="icons8_installing_updates_16px" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>Resources\icons8_installing_updates_16px.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="icons8_installing_updates_32px" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>Resources\icons8_installing_updates_32px.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="icons8_installing_updates_48px" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>Resources\icons8_installing_updates_48px.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="icons8_open_archive_16px" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>Resources\icons8_open_archive_16px.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="icons8_recycle_bin_16px" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>Resources\icons8_recycle_bin_16px.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="icons8_sand_timer_16px" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>Resources\icons8_sand_timer_16px.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="icons8_uninstalling_updates_12px" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>Resources\icons8_uninstalling_updates_12px.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="icons8_uninstalling_updates_16px" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>Resources\icons8_uninstalling_updates_16px.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="icons8_uninstalling_updates_32px" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>Resources\icons8_uninstalling_updates_32px.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="icons8_uninstalling_updates_48px" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>Resources\icons8_uninstalling_updates_48px.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
</root>

View File

@@ -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());
}
}

View File

@@ -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")]

View File

@@ -1,18 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
https://go.microsoft.com/fwlink/?LinkID=208121.
-->
<Project>
<PropertyGroup>
<Configuration>Release</Configuration>
<Platform>Any CPU</Platform>
<PublishDir>bin\publish\</PublishDir>
<PublishProtocol>FileSystem</PublishProtocol>
<_TargetId>Folder</_TargetId>
<TargetFramework>net8.0-windows</TargetFramework>
<RuntimeIdentifier>win-x86</RuntimeIdentifier>
<SelfContained>true</SelfContained>
<PublishSingleFile>true</PublishSingleFile>
<PublishReadyToRun>false</PublishReadyToRun>
</PropertyGroup>
</Project>

View File

@@ -1,63 +0,0 @@
//------------------------------------------------------------------------------
// <auto-generated>
// 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.
// </auto-generated>
//------------------------------------------------------------------------------
namespace Pilz.Updating.UpdateInstaller.My.Resources {
using System;
/// <summary>
/// Eine stark typisierte Ressourcenklasse zum Suchen von lokalisierten Zeichenfolgen usw.
/// </summary>
// 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() {
}
/// <summary>
/// Gibt die zwischengespeicherte ResourceManager-Instanz zurück, die von dieser Klasse verwendet wird.
/// </summary>
[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;
}
}
/// <summary>
/// Überschreibt die CurrentUICulture-Eigenschaft des aktuellen Threads für alle
/// Ressourcenzuordnungen, die diese stark typisierte Ressourcenklasse verwenden.
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Globalization.CultureInfo Culture {
get {
return resourceCulture;
}
set {
resourceCulture = value;
}
}
}
}

View File

@@ -1,120 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>

View File

@@ -1,26 +0,0 @@
//------------------------------------------------------------------------------
// <auto-generated>
// 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.
// </auto-generated>
//------------------------------------------------------------------------------
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;
}
}
}
}

View File

@@ -1,7 +0,0 @@
<?xml version='1.0' encoding='utf-8'?>
<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)" UseMySettingsClassName="true">
<Profiles>
<Profile Name="(Default)" />
</Profiles>
<Settings />
</SettingsFile>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 337 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 301 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 422 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 347 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 454 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 866 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 435 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 552 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 470 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 363 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 479 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 873 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 31 KiB

View File

@@ -7,16 +7,10 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Pilz.Updating.Client", "Pil
EndProject EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Pilz.Updating.GUIBase", "Pilz.Updating.GUIBase\Pilz.Updating.GUIBase.csproj", "{F668FCAA-0155-4C5C-8881-731AA9BC389C}" Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Pilz.Updating.GUIBase", "Pilz.Updating.GUIBase\Pilz.Updating.GUIBase.csproj", "{F668FCAA-0155-4C5C-8881-731AA9BC389C}"
EndProject EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Pilz.Updating.UpdateInstaller", "Pilz.Updating.UpdateInstaller\Pilz.Updating.UpdateInstaller.csproj", "{6CF782BA-019D-4651-9B00-48D2729B808F}" 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.Client.GUI", "Pilz.Updating.Client.GUI\Pilz.Updating.Client.GUI.csproj", "{4C91A7F0-FC08-4CA9-85E1-5B6304E033F3}"
EndProject EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Pilz.Updating", "Pilz.Updating\Pilz.Updating.csproj", "{CFC81C75-299C-4DE4-9F19-8E061972E271}" Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Pilz.Updating", "Pilz.Updating\Pilz.Updating.csproj", "{CFC81C75-299C-4DE4-9F19-8E061972E271}"
EndProject 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 Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU 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}.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.ActiveCfg = Release|Any CPU
{F668FCAA-0155-4C5C-8881-731AA9BC389C}.Release|Any CPU.Build.0 = 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.ActiveCfg = Debug|Any CPU
{4C91A7F0-FC08-4CA9-85E1-5B6304E033F3}.Debug|Any CPU.Build.0 = 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 {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}.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.ActiveCfg = Release|Any CPU
{CFC81C75-299C-4DE4-9F19-8E061972E271}.Release|Any CPU.Build.0 = 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 EndGlobalSection
GlobalSection(SolutionProperties) = preSolution GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE HideSolutionNode = FALSE

109
Pilz.Updating/AppVersion.cs Normal file
View File

@@ -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;
}
}

View File

@@ -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;
}
}

View File

@@ -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
{
/// <summary>
/// Writes the JSON representation of the object.
/// </summary>
/// <param name="writer">The <see cref="JsonWriter"/> to write to.</param>
/// <param name="value">The value.</param>
/// <param name="serializer">The calling serializer.</param>
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());
}
/// <summary>
/// Reads the JSON representation of the object.
/// </summary>
/// <param name="reader">The <see cref="JsonReader"/> to read from.</param>
/// <param name="objectType">Type of the object.</param>
/// <param name="existingValue">The existing value of object being read.</param>
/// <param name="serializer">The calling serializer.</param>
/// <returns>The object value.</returns>
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<AppVersion>();
}
}
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.");
}
/// <summary>
/// Determines whether this instance can convert the specified object type.
/// </summary>
/// <param name="objectType">Type of the object.</param>
/// <returns>
/// <c>true</c> if this instance can convert the specified object type; otherwise, <c>false</c>.
/// </returns>
public override bool CanConvert(Type objectType)
{
return objectType == typeof(AppVersion);
}
}

View File

@@ -3,6 +3,7 @@
<PropertyGroup> <PropertyGroup>
<TargetFrameworks>net8.0-windows</TargetFrameworks> <TargetFrameworks>net8.0-windows</TargetFrameworks>
<ImplicitUsings>enable</ImplicitUsings> <ImplicitUsings>enable</ImplicitUsings>
<Nullable>annotations</Nullable>
</PropertyGroup> </PropertyGroup>
<PropertyGroup> <PropertyGroup>

View File

@@ -4,7 +4,6 @@ namespace Pilz.Updating;
public class UpdateInfo public class UpdateInfo
{ {
public string UpdateInstallerLink { get; set; }
public List<UpdatePackageInfo> Packages { get; set; } = []; public List<UpdatePackageInfo> Packages { get; set; } = [];
public static UpdateInfo Parse(string str) public static UpdateInfo Parse(string str)

View File

@@ -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<UpdateInstallerConfig>(System.Text.Encoding.Default.GetString(Convert.FromBase64String(str)));
}
public override string ToString()
{
return Convert.ToBase64String(System.Text.Encoding.Default.GetBytes(JsonConvert.SerializeObject(this)));
}
}

View File

@@ -3,7 +3,7 @@
public class UpdatePackageInfo public class UpdatePackageInfo
{ {
public string Name { get; set; } public string Name { get; set; }
public ApplicationVersion Version { get; set; } public AppVersion Version { get; set; }
public UpdateNotes Notes { get; } = new(); public UpdateNotes Notes { get; } = new();
public string Packagelink { get; set; } public string Packagelink { get; set; }
} }