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