update projects (versions, nuget, references)
This commit is contained in:
@@ -46,19 +46,15 @@
|
|||||||
<DefineConstants>TRACE;RelMono</DefineConstants>
|
<DefineConstants>TRACE;RelMono</DefineConstants>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="Microsoft-WindowsAPICodePack-Shell" Version="1.1.4" />
|
<PackageReference Include="Microsoft-WindowsAPICodePack-Shell" Version="1.1.5" />
|
||||||
<PackageReference Include="Microsoft.VisualBasic" Version="10.3.0" />
|
<PackageReference Include="Microsoft.VisualBasic" Version="10.3.0" />
|
||||||
|
<PackageReference Include="Pilz.Cryptography" Version="1.0.0" />
|
||||||
<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="UI.for.WinForms.AllControls.Net60">
|
<PackageReference Include="UI.for.WinForms.AllControls.Net60">
|
||||||
<Version>2022.3.1109</Version>
|
<Version>2023.1.117</Version>
|
||||||
</PackageReference>
|
</PackageReference>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
|
||||||
<Reference Include="Pilz.Cryptography">
|
|
||||||
<HintPath>..\Shared Libs\Pilz.Cryptography.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
</ItemGroup>
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Import Include="Microsoft.VisualBasic" />
|
<Import Include="Microsoft.VisualBasic" />
|
||||||
<Import Include="System" />
|
<Import Include="System" />
|
||||||
@@ -220,8 +216,8 @@
|
|||||||
<ProjectReference Include="..\Pilz.Updating\Pilz.Updating.csproj" />
|
<ProjectReference Include="..\Pilz.Updating\Pilz.Updating.csproj" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="Markdig" Version="0.30.2" />
|
<PackageReference Include="Markdig" Version="0.33.0" />
|
||||||
<PackageReference Include="Newtonsoft.Json" Version="13.0.1" />
|
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
|
||||||
<PackageReference Include="System.Runtime.CompilerServices.Unsafe" Version="6.0.0" />
|
<PackageReference Include="System.Runtime.CompilerServices.Unsafe" Version="6.0.0" />
|
||||||
<PackageReference Include="Z.ExtensionMethods.WithNamespace" Version="2.1.1" />
|
<PackageReference Include="Z.ExtensionMethods.WithNamespace" Version="2.1.1" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|||||||
@@ -37,17 +37,18 @@
|
|||||||
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
|
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
|
||||||
<DefineConstants>TRACE;RelMono</DefineConstants>
|
<DefineConstants>TRACE;RelMono</DefineConstants>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
<PropertyGroup>
|
||||||
|
<GeneratePackageOnBuild>True</GeneratePackageOnBuild>
|
||||||
|
<IncrementVersionOnBuild>1.yyyy.Mdd.Hmm</IncrementVersionOnBuild>
|
||||||
|
<Version>1.2023.914.854</Version>
|
||||||
|
</PropertyGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="Microsoft.CSharp" Version="4.7.0" />
|
<PackageReference Include="Microsoft.CSharp" Version="4.7.0" />
|
||||||
<PackageReference Include="Microsoft.VisualBasic" Version="10.3.0" />
|
<PackageReference Include="Microsoft.VisualBasic" Version="10.3.0" />
|
||||||
|
<PackageReference Include="Pilz.Cryptography" Version="1.0.0" />
|
||||||
<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" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
|
||||||
<Reference Include="Pilz.Cryptography">
|
|
||||||
<HintPath>..\Shared Libs\Pilz.Cryptography.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
</ItemGroup>
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Import Include="Microsoft.VisualBasic" />
|
<Import Include="Microsoft.VisualBasic" />
|
||||||
<Import Include="System" />
|
<Import Include="System" />
|
||||||
@@ -101,11 +102,11 @@
|
|||||||
<ProjectReference Include="..\Pilz.Updating\Pilz.Updating.csproj" />
|
<ProjectReference Include="..\Pilz.Updating\Pilz.Updating.csproj" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="Discord.Net" Version="3.7.2" />
|
<PackageReference Include="Discord.Net" Version="3.12.0" />
|
||||||
<PackageReference Include="Markdig" Version="0.30.2" />
|
<PackageReference Include="Markdig" Version="0.33.0" />
|
||||||
<PackageReference Include="Microsoft.Bcl.AsyncInterfaces" Version="6.0.0" />
|
<PackageReference Include="Microsoft.Bcl.AsyncInterfaces" Version="7.0.0" />
|
||||||
<PackageReference Include="Newtonsoft.Json" Version="13.0.1" />
|
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
|
||||||
<PackageReference Include="System.Collections.Immutable" Version="6.0.0" />
|
<PackageReference Include="System.Collections.Immutable" Version="7.0.0" />
|
||||||
<PackageReference Include="System.Interactive.Async" Version="6.0.1" />
|
<PackageReference Include="System.Interactive.Async" Version="6.0.1" />
|
||||||
<PackageReference Include="System.Runtime.CompilerServices.Unsafe" Version="6.0.0" />
|
<PackageReference Include="System.Runtime.CompilerServices.Unsafe" Version="6.0.0" />
|
||||||
<PackageReference Include="WebDav.Client" Version="2.8.0" />
|
<PackageReference Include="WebDav.Client" Version="2.8.0" />
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
|
namespace Pilz.Updating.UpdateInstaller
|
||||||
namespace Pilz.Updating.UpdateInstaller
|
|
||||||
{
|
{
|
||||||
public static class PackageFileNameDefinations
|
public static class PackageFileNameDefinations
|
||||||
{
|
{
|
||||||
@@ -40,14 +40,16 @@
|
|||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<GeneratePackageOnBuild>True</GeneratePackageOnBuild>
|
<GeneratePackageOnBuild>True</GeneratePackageOnBuild>
|
||||||
|
<IncrementVersionOnBuild>1.yyyy.Mdd.Hmm</IncrementVersionOnBuild>
|
||||||
|
<Version>1.2023.914.854</Version>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="Microsoft.VisualBasic" Version="10.3.0" />
|
<PackageReference Include="Microsoft.VisualBasic" Version="10.3.0" />
|
||||||
|
<PackageReference Include="Pilz.IO" Version="1.0.0" />
|
||||||
<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="ui.for.winforms.allcontrols.net60" Version="2022.2.510" />
|
|
||||||
<PackageReference Include="UI.for.WinForms.AllControls.Net60">
|
<PackageReference Include="UI.for.WinForms.AllControls.Net60">
|
||||||
<Version>2022.3.1109</Version>
|
<Version>2023.1.117</Version>
|
||||||
</PackageReference>
|
</PackageReference>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
@@ -97,11 +99,6 @@
|
|||||||
<DependentUpon>Settings.settings</DependentUpon>
|
<DependentUpon>Settings.settings</DependentUpon>
|
||||||
<DesignTimeSharedInput>True</DesignTimeSharedInput>
|
<DesignTimeSharedInput>True</DesignTimeSharedInput>
|
||||||
</Compile>
|
</Compile>
|
||||||
<Compile Update="UpdatingClientGuiLangRes.de.Designer.cs">
|
|
||||||
<DependentUpon>UpdatingClientGuiLangRes.de.resx</DependentUpon>
|
|
||||||
<AutoGen>True</AutoGen>
|
|
||||||
<DesignTime>True</DesignTime>
|
|
||||||
</Compile>
|
|
||||||
<Compile Update="UpdatingClientGuiLangRes.Designer.cs">
|
<Compile Update="UpdatingClientGuiLangRes.Designer.cs">
|
||||||
<AutoGen>True</AutoGen>
|
<AutoGen>True</AutoGen>
|
||||||
<DesignTime>True</DesignTime>
|
<DesignTime>True</DesignTime>
|
||||||
@@ -133,8 +130,7 @@
|
|||||||
<SubType>Designer</SubType>
|
<SubType>Designer</SubType>
|
||||||
</EmbeddedResource>
|
</EmbeddedResource>
|
||||||
<EmbeddedResource Update="UpdatingClientGuiLangRes.de.resx">
|
<EmbeddedResource Update="UpdatingClientGuiLangRes.de.resx">
|
||||||
<Generator>ResXFileCodeGenerator</Generator>
|
<Generator></Generator>
|
||||||
<LastGenOutput>UpdatingClientGuiLangRes.de.Designer.cs</LastGenOutput>
|
|
||||||
<CustomToolNamespace>Pilz.Updating.Client.GUI</CustomToolNamespace>
|
<CustomToolNamespace>Pilz.Updating.Client.GUI</CustomToolNamespace>
|
||||||
</EmbeddedResource>
|
</EmbeddedResource>
|
||||||
<EmbeddedResource Update="UpdatingClientGuiLangRes.resx">
|
<EmbeddedResource Update="UpdatingClientGuiLangRes.resx">
|
||||||
@@ -160,10 +156,9 @@
|
|||||||
<ProjectReference Include="..\Pilz.Updating\Pilz.Updating.csproj" />
|
<ProjectReference Include="..\Pilz.Updating\Pilz.Updating.csproj" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="HtmlRenderer.Core" Version="1.5.0.6" />
|
<PackageReference Include="Markdig" Version="0.33.0" />
|
||||||
<PackageReference Include="HtmlRenderer.WinForms" Version="1.5.0.6" />
|
|
||||||
<PackageReference Include="Markdig" Version="0.30.2" />
|
|
||||||
<PackageReference Include="System.Runtime.CompilerServices.Unsafe" Version="6.0.0" />
|
<PackageReference Include="System.Runtime.CompilerServices.Unsafe" Version="6.0.0" />
|
||||||
|
<PackageReference Include="Westermo.HtmlRenderer.WinForms" Version="1.6.0" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Compile Remove="obj\RelMono\TemporaryGeneratedFile_036C0B5B-1481-4323-8D20-8F5ADCB23D92.cs" />
|
<Compile Remove="obj\RelMono\TemporaryGeneratedFile_036C0B5B-1481-4323-8D20-8F5ADCB23D92.cs" />
|
||||||
|
|||||||
@@ -12,66 +12,20 @@ namespace Pilz.Updating.Client.GUI
|
|||||||
|
|
||||||
public void SetCurrentState(UpdateStatus curAction)
|
public void SetCurrentState(UpdateStatus curAction)
|
||||||
{
|
{
|
||||||
SetCurrentStateInternal(curAction, -1);
|
string progressText = curAction switch
|
||||||
}
|
{
|
||||||
|
UpdateStatus.Waiting => UpdatingClientGuiLangRes.SimpleActions_Waiting,
|
||||||
|
UpdateStatus.Searching => UpdatingClientGuiLangRes.SimpleActions_Searching,
|
||||||
|
UpdateStatus.DownloadingPackage => UpdatingClientGuiLangRes.SimpleActions_DownloadingPackage,
|
||||||
|
UpdateStatus.DownloadingInstaller => UpdatingClientGuiLangRes.SimpleActions_DownloadingInstaller,
|
||||||
|
UpdateStatus.StartingInstaller => UpdatingClientGuiLangRes.SimpleActions_StartingInstaller,
|
||||||
|
_ => string.Empty,
|
||||||
|
};
|
||||||
|
|
||||||
public void SetCurrentState(UpdateStatus curAction, int progress)
|
|
||||||
{
|
|
||||||
SetCurrentStateInternal(curAction, progress);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void SetCurrentStateInternal(UpdateStatus curAction, int progress)
|
|
||||||
{
|
|
||||||
var progressText = string.Empty;
|
|
||||||
|
|
||||||
switch (curAction)
|
|
||||||
{
|
|
||||||
case UpdateStatus.Waiting:
|
|
||||||
{
|
|
||||||
progressText = UpdatingClientGuiLangRes.SimpleActions_Waiting;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
case UpdateStatus.Searching:
|
|
||||||
{
|
|
||||||
progressText = UpdatingClientGuiLangRes.SimpleActions_Searching;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
case UpdateStatus.DownloadingInstaller:
|
|
||||||
{
|
|
||||||
progressText = UpdatingClientGuiLangRes.SimpleActions_DownloadingInstaller;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
case UpdateStatus.DownloadingPackage:
|
|
||||||
{
|
|
||||||
progressText = UpdatingClientGuiLangRes.SimpleActions_DownloadingPackage;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
case UpdateStatus.StartingInstaller:
|
|
||||||
{
|
|
||||||
progressText = UpdatingClientGuiLangRes.SimpleActions_DownloadingInstaller;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (progress == -1)
|
|
||||||
{
|
|
||||||
radProgressBar1.Visible = false;
|
radProgressBar1.Visible = false;
|
||||||
radWaitingBar1.Text = progressText;
|
radWaitingBar1.Text = progressText;
|
||||||
radWaitingBar1.BringToFront();
|
radWaitingBar1.BringToFront();
|
||||||
radWaitingBar1.StartWaiting();
|
radWaitingBar1.StartWaiting();
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
radWaitingBar1.StopWaiting();
|
|
||||||
radProgressBar1.Text = progressText + $" ({progress}%)";
|
|
||||||
radProgressBar1.Value1 = progress;
|
|
||||||
radProgressBar1.BringToFront();
|
|
||||||
radProgressBar1.Visible = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -7,6 +7,7 @@ using Microsoft.VisualBasic.CompilerServices;
|
|||||||
using global::Pilz.Updating.Client.GUI.My.Resources;
|
using global::Pilz.Updating.Client.GUI.My.Resources;
|
||||||
using System;
|
using System;
|
||||||
using Telerik.WinControls;
|
using Telerik.WinControls;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
namespace Pilz.Updating.Client.GUI
|
namespace Pilz.Updating.Client.GUI
|
||||||
{
|
{
|
||||||
@@ -59,13 +60,7 @@ namespace Pilz.Updating.Client.GUI
|
|||||||
|
|
||||||
public bool UseHiddenSearch { get; set; } = false;
|
public bool UseHiddenSearch { get; set; } = false;
|
||||||
|
|
||||||
private Image MyAppIcon
|
private static Image MyAppIcon => Icon.ExtractAssociatedIcon(IO.Extensions.GetExecutablePath()).ToBitmap();
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
return Icon.ExtractAssociatedIcon(Assembly.GetEntryAssembly().Location).ToBitmap();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// C o n s t r u c t o r s
|
// C o n s t r u c t o r s
|
||||||
|
|
||||||
@@ -76,10 +71,10 @@ namespace Pilz.Updating.Client.GUI
|
|||||||
|
|
||||||
// F e a t u r e s
|
// F e a t u r e s
|
||||||
|
|
||||||
public void UpdateInteractive(Form parentForm)
|
public async Task UpdateInteractive(Form parentForm)
|
||||||
{
|
{
|
||||||
this.parentForm = parentForm;
|
this.parentForm = parentForm;
|
||||||
UpdateClient.UpdateInteractiveAsync();
|
await UpdateClient.UpdateInteractive();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void EndUpdating()
|
private void EndUpdating()
|
||||||
@@ -88,7 +83,7 @@ namespace Pilz.Updating.Client.GUI
|
|||||||
UpdateClient = null;
|
UpdateClient = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void MyUpdateClient_UpdateStatusChanged(UpdateStatus newStatus, int progress)
|
private void MyUpdateClient_UpdateStatusChanged(UpdateStatus newStatus)
|
||||||
{
|
{
|
||||||
bool useGui = false;
|
bool useGui = false;
|
||||||
if (!(newStatus == UpdateStatus.Searching && UseHiddenSearch))
|
if (!(newStatus == UpdateStatus.Searching && UseHiddenSearch))
|
||||||
@@ -106,7 +101,7 @@ namespace Pilz.Updating.Client.GUI
|
|||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
|
|
||||||
curProgressDialog?.Invoke(new Action(() => curProgressDialog.SetCurrentState(newStatus, progress)));
|
curProgressDialog?.Invoke(new Action(() => curProgressDialog.SetCurrentState(newStatus)));
|
||||||
}
|
}
|
||||||
|
|
||||||
private void MyUpdateClient_DownloadingUpdate(UpdatePackageInfo pkg, CancelEventArgs e)
|
private void MyUpdateClient_DownloadingUpdate(UpdatePackageInfo pkg, CancelEventArgs e)
|
||||||
|
|||||||
@@ -105,6 +105,15 @@ namespace Pilz.Updating.Client.GUI {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Sucht eine lokalisierte Zeichenfolge, die Starting Installer ... ähnelt.
|
||||||
|
/// </summary>
|
||||||
|
internal static string SimpleActions_StartingInstaller {
|
||||||
|
get {
|
||||||
|
return ResourceManager.GetString("SimpleActions_StartingInstaller", resourceCulture);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Sucht eine lokalisierte Zeichenfolge, die Waiting ... ähnelt.
|
/// Sucht eine lokalisierte Zeichenfolge, die Waiting ... ähnelt.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|||||||
@@ -1 +0,0 @@
|
|||||||
|
|
||||||
@@ -132,6 +132,9 @@
|
|||||||
<data name="SimpleActions_Searching" xml:space="preserve">
|
<data name="SimpleActions_Searching" xml:space="preserve">
|
||||||
<value>Nach Updates suchen ...</value>
|
<value>Nach Updates suchen ...</value>
|
||||||
</data>
|
</data>
|
||||||
|
<data name="SimpleActions_StartingInstaller" xml:space="preserve">
|
||||||
|
<value>Starte Installer ...</value>
|
||||||
|
</data>
|
||||||
<data name="SimpleActions_Waiting" xml:space="preserve">
|
<data name="SimpleActions_Waiting" xml:space="preserve">
|
||||||
<value>Warten ...</value>
|
<value>Warten ...</value>
|
||||||
</data>
|
</data>
|
||||||
|
|||||||
@@ -132,6 +132,9 @@
|
|||||||
<data name="SimpleActions_Searching" xml:space="preserve">
|
<data name="SimpleActions_Searching" xml:space="preserve">
|
||||||
<value>Searching for Updates ...</value>
|
<value>Searching for Updates ...</value>
|
||||||
</data>
|
</data>
|
||||||
|
<data name="SimpleActions_StartingInstaller" xml:space="preserve">
|
||||||
|
<value>Starting Installer ...</value>
|
||||||
|
</data>
|
||||||
<data name="SimpleActions_Waiting" xml:space="preserve">
|
<data name="SimpleActions_Waiting" xml:space="preserve">
|
||||||
<value>Waiting ...</value>
|
<value>Waiting ...</value>
|
||||||
</data>
|
</data>
|
||||||
|
|||||||
@@ -39,6 +39,8 @@
|
|||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<GeneratePackageOnBuild>True</GeneratePackageOnBuild>
|
<GeneratePackageOnBuild>True</GeneratePackageOnBuild>
|
||||||
|
<IncrementVersionOnBuild>1.yyyy.Mdd.Hmm</IncrementVersionOnBuild>
|
||||||
|
<Version>1.2023.914.854</Version>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="Microsoft.VisualBasic" Version="10.3.0" />
|
<PackageReference Include="Microsoft.VisualBasic" Version="10.3.0" />
|
||||||
@@ -94,10 +96,11 @@
|
|||||||
</None>
|
</None>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
<ProjectReference Include="..\Pilz.Updating.Administration\Pilz.Updating.Administration.csproj" />
|
||||||
<ProjectReference Include="..\Pilz.Updating\Pilz.Updating.csproj" />
|
<ProjectReference Include="..\Pilz.Updating\Pilz.Updating.csproj" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="Newtonsoft.Json" Version="13.0.1" />
|
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
|
||||||
<PackageReference Include="Z.ExtensionMethods.WithNamespace" Version="2.1.1" />
|
<PackageReference Include="Z.ExtensionMethods.WithNamespace" Version="2.1.1" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
|||||||
@@ -5,8 +5,10 @@ using System.Diagnostics;
|
|||||||
using System.Drawing;
|
using System.Drawing;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.IO.Compression;
|
using System.IO.Compression;
|
||||||
|
using System.IO.Pipes;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Net;
|
using System.Net;
|
||||||
|
using System.Net.Http;
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using Microsoft.VisualBasic.CompilerServices;
|
using Microsoft.VisualBasic.CompilerServices;
|
||||||
@@ -21,7 +23,7 @@ namespace Pilz.Updating
|
|||||||
|
|
||||||
public event UpdateStatusChangedEventHandler UpdateStatusChanged;
|
public event UpdateStatusChangedEventHandler UpdateStatusChanged;
|
||||||
|
|
||||||
public delegate void UpdateStatusChangedEventHandler(UpdateStatus newStatus, int progress);
|
public delegate void UpdateStatusChangedEventHandler(UpdateStatus newStatus);
|
||||||
|
|
||||||
public event DownloadingUpdateEventHandler DownloadingUpdate;
|
public event DownloadingUpdateEventHandler DownloadingUpdate;
|
||||||
|
|
||||||
@@ -46,7 +48,7 @@ namespace Pilz.Updating
|
|||||||
|
|
||||||
// P r o p e r t i e s
|
// P r o p e r t i e s
|
||||||
|
|
||||||
public WebClient WebClient { get; private set; } = new WebClient();
|
public HttpClient WebClient { get; private set; } = new();
|
||||||
public string UpdateUrl { get; private set; }
|
public string UpdateUrl { get; private set; }
|
||||||
public ApplicationVersion CurrentVersion { get; private set; }
|
public ApplicationVersion CurrentVersion { get; private set; }
|
||||||
public Channels MinimumChannel { get; private set; }
|
public Channels MinimumChannel { get; private set; }
|
||||||
@@ -69,7 +71,6 @@ namespace Pilz.Updating
|
|||||||
UpdateUrl = updateUrl;
|
UpdateUrl = updateUrl;
|
||||||
CurrentVersion = currentVersion;
|
CurrentVersion = currentVersion;
|
||||||
MinimumChannel = (Channels)Math.Max((int)minimumChannel, (int)currentVersion.Channel);
|
MinimumChannel = (Channels)Math.Max((int)minimumChannel, (int)currentVersion.Channel);
|
||||||
WebClient.DownloadProgressChanged += WebClient_DownloadProgressChanged;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// E v e n t M e t h o d s
|
// E v e n t M e t h o d s
|
||||||
@@ -88,71 +89,49 @@ namespace Pilz.Updating
|
|||||||
return e.Cancel;
|
return e.Cancel;
|
||||||
}
|
}
|
||||||
|
|
||||||
// W e b C l i e n t E v e n t s
|
|
||||||
|
|
||||||
private void WebClient_DownloadProgressChanged(object sender, DownloadProgressChangedEventArgs e)
|
|
||||||
{
|
|
||||||
RaiseUpdateStatusChanged(curDownloadingStatus, e.ProgressPercentage);
|
|
||||||
}
|
|
||||||
|
|
||||||
// U p d a t e R o u t i n e s
|
// U p d a t e R o u t i n e s
|
||||||
|
|
||||||
public Task UpdateInteractiveAsync()
|
public async Task UpdateInteractive()
|
||||||
{
|
{
|
||||||
return Task.Run(UpdateInteractive);
|
var latestVersion = await CheckForUpdate();
|
||||||
}
|
|
||||||
|
|
||||||
public void UpdateInteractive()
|
|
||||||
{
|
|
||||||
var latestVersion = CheckForUpdate();
|
|
||||||
if (latestVersion is null)
|
if (latestVersion is null)
|
||||||
{
|
|
||||||
NoUpdatesFound?.Invoke();
|
NoUpdatesFound?.Invoke();
|
||||||
}
|
|
||||||
else
|
else
|
||||||
{
|
await UpdateInteractive(latestVersion);
|
||||||
UpdateInteractive(latestVersion);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void UpdateInteractive(UpdatePackageInfo package)
|
public async Task UpdateInteractive(UpdatePackageInfo package)
|
||||||
{
|
{
|
||||||
if (!RaiseDownloadingUpdate(package) && DownloadPackage(package))
|
if (!RaiseDownloadingUpdate(package) && await DownloadPackageAsync(package))
|
||||||
{
|
{
|
||||||
if (!RaiseInstallingUpdate(package))
|
if (!RaiseInstallingUpdate(package))
|
||||||
{
|
await InstallPackage(package);
|
||||||
InstallPackage(package);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void RaiseUpdateStatusChanged(UpdateStatus newStatus, int progress = -1)
|
public void RaiseUpdateStatusChanged(UpdateStatus newStatus)
|
||||||
{
|
{
|
||||||
UpdateStatusChanged?.Invoke(newStatus, progress);
|
UpdateStatusChanged?.Invoke(newStatus);
|
||||||
}
|
}
|
||||||
|
|
||||||
// F e a t u r e s
|
// F e a t u r e s
|
||||||
|
|
||||||
public UpdateInfo GetUpdateInfo()
|
public async Task<UpdateInfo> GetUpdateInfo()
|
||||||
{
|
{
|
||||||
string str = WebClient.DownloadString(UpdateUrl);
|
string str = await WebClient.GetStringAsync(UpdateUrl);
|
||||||
var info = UpdateInfo.Parse(str);
|
var info = UpdateInfo.Parse(str);
|
||||||
return info;
|
return info;
|
||||||
}
|
}
|
||||||
|
|
||||||
public UpdatePackageInfo CheckForUpdate()
|
public async Task<UpdatePackageInfo> CheckForUpdate()
|
||||||
{
|
{
|
||||||
RaiseUpdateStatusChanged(UpdateStatus.Searching);
|
RaiseUpdateStatusChanged(UpdateStatus.Searching);
|
||||||
UpdateInfo = GetUpdateInfo();
|
UpdateInfo = await GetUpdateInfo();
|
||||||
if (UpdateInfo is object)
|
if (UpdateInfo is not null)
|
||||||
{
|
|
||||||
return CheckForUpdate(UpdateInfo);
|
return CheckForUpdate(UpdateInfo);
|
||||||
}
|
|
||||||
else
|
else
|
||||||
{
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
public UpdatePackageInfo CheckForUpdate(UpdateInfo updateInfo)
|
public UpdatePackageInfo CheckForUpdate(UpdateInfo updateInfo)
|
||||||
{
|
{
|
||||||
@@ -172,7 +151,7 @@ namespace Pilz.Updating
|
|||||||
return foundPkgInfo;
|
return foundPkgInfo;
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool DownloadPackage(UpdatePackageInfo package)
|
public async Task<bool> DownloadPackageAsync(UpdatePackageInfo package)
|
||||||
{
|
{
|
||||||
curDownloadingStatus = UpdateStatus.DownloadingPackage;
|
curDownloadingStatus = UpdateStatus.DownloadingPackage;
|
||||||
RaiseUpdateStatusChanged(curDownloadingStatus);
|
RaiseUpdateStatusChanged(curDownloadingStatus);
|
||||||
@@ -183,14 +162,14 @@ namespace Pilz.Updating
|
|||||||
{
|
{
|
||||||
// Ensure existing and empty directory for the Zip File
|
// Ensure existing and empty directory for the Zip File
|
||||||
if (dir.Exists)
|
if (dir.Exists)
|
||||||
{
|
|
||||||
dir.Delete(true);
|
dir.Delete(true);
|
||||||
}
|
|
||||||
|
|
||||||
dir.Create();
|
dir.Create();
|
||||||
|
|
||||||
// Download zip package
|
// Download zip package
|
||||||
WebClient.DownloadFile(package.Packagelink, zipPath);
|
using var zipFile = new FileStream(zipPath, FileMode.Create, FileAccess.ReadWrite);
|
||||||
|
using var zipStream = await WebClient.GetStreamAsync(package.Packagelink);
|
||||||
|
await zipStream.CopyToAsync(zipFile);
|
||||||
|
|
||||||
// Remember path to package directory
|
// Remember path to package directory
|
||||||
dicPackagePaths.Add(package, dirPath);
|
dicPackagePaths.Add(package, dirPath);
|
||||||
@@ -203,7 +182,7 @@ namespace Pilz.Updating
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
private FileInfo DownloadUpdateInstaller()
|
private async Task<FileInfo> DownloadUpdateInstaller()
|
||||||
{
|
{
|
||||||
curDownloadingStatus = UpdateStatus.DownloadingInstaller;
|
curDownloadingStatus = UpdateStatus.DownloadingInstaller;
|
||||||
RaiseUpdateStatusChanged(curDownloadingStatus);
|
RaiseUpdateStatusChanged(curDownloadingStatus);
|
||||||
@@ -211,17 +190,19 @@ namespace Pilz.Updating
|
|||||||
// Ensure update installer path is empty
|
// Ensure update installer path is empty
|
||||||
var installerDirPath = new DirectoryInfo(Path.Combine(MyPaths.GetMyAppDataPath(), "UpdateInstallerTool"));
|
var installerDirPath = new DirectoryInfo(Path.Combine(MyPaths.GetMyAppDataPath(), "UpdateInstallerTool"));
|
||||||
if (installerDirPath.Exists)
|
if (installerDirPath.Exists)
|
||||||
{
|
|
||||||
installerDirPath.Delete(true);
|
installerDirPath.Delete(true);
|
||||||
}
|
|
||||||
|
|
||||||
Task.Delay(100);
|
await Task.Delay(100);
|
||||||
installerDirPath.Create();
|
installerDirPath.Create();
|
||||||
Task.Delay(100);
|
await Task.Delay(100);
|
||||||
|
|
||||||
// Download update installer zip
|
// Download update installer zip
|
||||||
string installerZipPath = Path.Combine(installerDirPath.FullName, "UpdatenInstaller.zip");
|
var installerZipPath = Path.Combine(installerDirPath.FullName, "UpdatenInstaller.zip");
|
||||||
WebClient.DownloadFile(UpdateInfo.UpdateInstallerLink, installerZipPath);
|
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
|
// Extract update installer
|
||||||
var installerExtractPath = installerDirPath.CreateSubdirectory("extracted");
|
var installerExtractPath = installerDirPath.CreateSubdirectory("extracted");
|
||||||
@@ -262,26 +243,24 @@ namespace Pilz.Updating
|
|||||||
UpdateInstallerStarted?.Invoke();
|
UpdateInstallerStarted?.Invoke();
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool InstallPackage(UpdatePackageInfo package)
|
public async Task<bool> InstallPackage(UpdatePackageInfo package)
|
||||||
{
|
{
|
||||||
string packagePath = null;
|
if (dicPackagePaths.TryGetValue(package, out var packagePath))
|
||||||
bool hasDownloaded = dicPackagePaths.TryGetValue(package, out packagePath);
|
|
||||||
if (hasDownloaded)
|
|
||||||
{
|
{
|
||||||
// Download update installer
|
// Download update installer
|
||||||
var installerPath = DownloadUpdateInstaller();
|
var installerPath = await DownloadUpdateInstaller();
|
||||||
|
|
||||||
// Start update installer
|
// Start update installer
|
||||||
StartUpdateInstaller(packagePath, installerPath.FullName);
|
StartUpdateInstaller(packagePath, installerPath.FullName);
|
||||||
|
|
||||||
// Close Host Application
|
// Close Host Application
|
||||||
if (AutoCloseHostApplication)
|
if (AutoCloseHostApplication)
|
||||||
{
|
|
||||||
Environment.Exit(Environment.ExitCode);
|
Environment.Exit(Environment.ExitCode);
|
||||||
}
|
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
return hasDownloaded;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -38,6 +38,8 @@
|
|||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<GeneratePackageOnBuild>True</GeneratePackageOnBuild>
|
<GeneratePackageOnBuild>True</GeneratePackageOnBuild>
|
||||||
|
<IncrementVersionOnBuild>1.yyyy.Mdd.Hmm</IncrementVersionOnBuild>
|
||||||
|
<Version>1.2023.914.854</Version>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="Microsoft.VisualBasic" Version="10.3.0" />
|
<PackageReference Include="Microsoft.VisualBasic" Version="10.3.0" />
|
||||||
|
|||||||
@@ -51,7 +51,7 @@
|
|||||||
<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="UI.for.WinForms.AllControls.Net60">
|
<PackageReference Include="UI.for.WinForms.AllControls.Net60">
|
||||||
<Version>2022.3.1109</Version>
|
<Version>2023.1.117</Version>
|
||||||
</PackageReference>
|
</PackageReference>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
@@ -148,7 +148,7 @@
|
|||||||
<ProjectReference Include="..\Pilz.Updating\Pilz.Updating.csproj" />
|
<ProjectReference Include="..\Pilz.Updating\Pilz.Updating.csproj" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="Newtonsoft.Json" Version="13.0.1" />
|
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
|
||||||
<PackageReference Include="Z.ExtensionMethods.WithNamespace" Version="2.1.1" />
|
<PackageReference Include="Z.ExtensionMethods.WithNamespace" Version="2.1.1" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
|||||||
@@ -39,6 +39,8 @@
|
|||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<GeneratePackageOnBuild>True</GeneratePackageOnBuild>
|
<GeneratePackageOnBuild>True</GeneratePackageOnBuild>
|
||||||
|
<IncrementVersionOnBuild>1.yyyy.Mdd.Hmm</IncrementVersionOnBuild>
|
||||||
|
<Version>1.2023.914.854</Version>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="Microsoft.VisualBasic" Version="10.3.0" />
|
<PackageReference Include="Microsoft.VisualBasic" Version="10.3.0" />
|
||||||
@@ -92,7 +94,7 @@
|
|||||||
</None>
|
</None>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="Newtonsoft.Json" Version="13.0.1" />
|
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Compile Remove="obj\RelMono\TemporaryGeneratedFile_036C0B5B-1481-4323-8D20-8F5ADCB23D92.cs" />
|
<Compile Remove="obj\RelMono\TemporaryGeneratedFile_036C0B5B-1481-4323-8D20-8F5ADCB23D92.cs" />
|
||||||
|
|||||||
Reference in New Issue
Block a user