From 64c0aded091c41b2cf52cc0f84a7977552f79561 Mon Sep 17 00:00:00 2001 From: Dominic Beger Date: Sun, 3 Sep 2017 00:22:36 +0200 Subject: [PATCH 1/6] Fix that nUpdate stopped updating when adding an entry to the statistics failed --- nUpdate/UI/Dialogs/UpdateDownloadDialog.cs | 11 +++- nUpdate/Updating/UpdateManager.cs | 71 +++++++++------------- nUpdate/Updating/UpdaterUi.cs | 8 ++- 3 files changed, 46 insertions(+), 44 deletions(-) diff --git a/nUpdate/UI/Dialogs/UpdateDownloadDialog.cs b/nUpdate/UI/Dialogs/UpdateDownloadDialog.cs index 41e1346e..1e74b3dc 100644 --- a/nUpdate/UI/Dialogs/UpdateDownloadDialog.cs +++ b/nUpdate/UI/Dialogs/UpdateDownloadDialog.cs @@ -62,8 +62,7 @@ public void CloseDialog(object state) protected virtual void OnCancelButtonClicked() { - if (CancelButtonClicked != null) - CancelButtonClicked(this, EventArgs.Empty); + CancelButtonClicked?.Invoke(this, EventArgs.Empty); } public void ShowModalDialog(object dialogResultReference) @@ -133,6 +132,14 @@ public void Failed(object sender, FailedEventArgs e) DialogResult = DialogResult.Cancel; } + public void StatisticsEntryFailed(object sender, FailedEventArgs e) + { + Invoke(new Action(() => Popup.ShowPopup(this, SystemIcons.Warning, + "Error while adding a new statistics entry.", + e.Exception, PopupButtons.Ok))); + DialogResult = DialogResult.OK; + } + public void Finished(object sender, EventArgs e) { DialogResult = DialogResult.OK; diff --git a/nUpdate/Updating/UpdateManager.cs b/nUpdate/Updating/UpdateManager.cs index f37d8a29..3f669729 100644 --- a/nUpdate/Updating/UpdateManager.cs +++ b/nUpdate/Updating/UpdateManager.cs @@ -317,13 +317,11 @@ public bool SearchForUpdates() } TotalSize = updatePackageSize; - if (_searchCancellationTokenSource.Token.IsCancellationRequested) - { - Cleanup(); - throw new OperationCanceledException(); - } + if (!_searchCancellationTokenSource.Token.IsCancellationRequested) + return true; - return true; + Cleanup(); + throw new OperationCanceledException(); } /// @@ -450,20 +448,14 @@ public void DownloadPackages() if (!updateConfiguration.UseStatistics || !IncludeCurrentPcIntoStatistics) continue; - try - { - var response = - new WebClient {Credentials = HttpAuthenticationCredentials}.DownloadString( - $"{updateConfiguration.UpdatePhpFileUri}?versionid={updateConfiguration.VersionId}&os={SystemInformation.OperatingSystemName}"); // Only for calling it - if (!string.IsNullOrEmpty(response)) - throw new StatisticsException(string.Format( - _lp.StatisticsScriptExceptionText, response)); - } - catch (Exception ex) - { - OnStatisticsEntryFailed(ex); - throw new StatisticsException(ex.Message); - } + var response = + new WebClient {Credentials = HttpAuthenticationCredentials}.DownloadString( + $"{updateConfiguration.UpdatePhpFileUri}?versionid={updateConfiguration.VersionId}&os={SystemInformation.OperatingSystemName}"); // Only for calling it + + if (string.IsNullOrEmpty(response)) + return; + OnStatisticsEntryFailed(new StatisticsException(string.Format( + _lp.StatisticsScriptExceptionText, response))); } } } @@ -486,10 +478,11 @@ public void DownloadPackagesAsync() TaskScheduler.Default); } -#if PROVIDE_TAP /// -/// Downloads the available update packages from the server, asynchronously. -/// -/// +#if PROVIDE_TAP + /// + /// Downloads the available update packages from the server, asynchronously. + /// + /// public async Task DownloadPackagesAsync(IProgress progress) { _downloadCancellationTokenSource?.Dispose(); @@ -497,8 +490,8 @@ public async Task DownloadPackagesAsync(IProgress GetUpdatePackageSize(config.UpdatePackageUri)) - .Where(updatePackageSize => updatePackageSize != null) - .Sum(updatePackageSize => updatePackageSize.Value); + .Where(updatePackageSize => updatePackageSize != null) + .Sum(updatePackageSize => updatePackageSize.Value); if (!Directory.Exists(_applicationUpdateDirectory)) Directory.CreateDirectory(_applicationUpdateDirectory); @@ -554,28 +547,24 @@ public async Task DownloadPackagesAsync(IProgress downloadDialog.ProgressPercentage = (int) args.Percentage; - + await UpdateManagerInstance.DownloadPackagesAsync(progressIndicator); } catch (OperationCanceledException) { return; } + catch (StatisticsException ex) + { + downloadDialog.StatisticsEntryFail(ex); + } catch (Exception ex) { downloadDialog.Fail(ex); @@ -223,6 +228,7 @@ public void ShowUserInterface() UpdateManagerInstance.PackagesDownloadProgressChanged += downloadDialog.ProgressChanged; UpdateManagerInstance.PackagesDownloadFinished += downloadDialog.Finished; UpdateManagerInstance.PackagesDownloadFailed += downloadDialog.Failed; + UpdateManagerInstance.StatisticsEntryFailed += downloadDialog.StatisticsEntryFailed; Task.Factory.StartNew(() => { From 6c0fd1503bc865042610daf1e2be1976e73a920c Mon Sep 17 00:00:00 2001 From: Dominic Beger Date: Sun, 3 Sep 2017 00:23:26 +0200 Subject: [PATCH 2/6] Fix a bug that the application terminated even when clicking "No" in the UAC-dialog --- nUpdate/Updating/UpdateManager.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/nUpdate/Updating/UpdateManager.cs b/nUpdate/Updating/UpdateManager.cs index 3f669729..8a9beda8 100644 --- a/nUpdate/Updating/UpdateManager.cs +++ b/nUpdate/Updating/UpdateManager.cs @@ -753,6 +753,7 @@ public void InstallPackage() Cleanup(); if (ex.NativeErrorCode != 1223) throw; + return; } if (CloseHostApplication) From a488999af68dacb98a89c496a7e22d1986859492 Mon Sep 17 00:00:00 2001 From: Dominic Beger Date: Sun, 3 Sep 2017 00:26:56 +0200 Subject: [PATCH 3/6] Fix a possible uncaught exception when starting the installer fails --- nUpdate/Updating/UpdaterUi.cs | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/nUpdate/Updating/UpdaterUi.cs b/nUpdate/Updating/UpdaterUi.cs index 7e40c1a4..02cf6b37 100644 --- a/nUpdate/Updating/UpdaterUi.cs +++ b/nUpdate/Updating/UpdaterUi.cs @@ -210,7 +210,25 @@ public void ShowUserInterface() _lp.SignatureNotMatchingErrorText, PopupButtons.Ok), null); else - UpdateManagerInstance.InstallPackage(); + { + try + { + UpdateManagerInstance.InstallPackage(); + } + catch (Win32Exception ex) + { + // TODO: Localize + _context.Send(o => Popup.ShowPopup(SystemIcons.Error, "Error while starting the installer.", + ex, + PopupButtons.Ok), null); + } + catch (Exception ex) + { + _context.Send(o => Popup.ShowPopup(SystemIcons.Error, _lp.InstallerInitializingErrorCaption, + ex, + PopupButtons.Ok), null); + } + } }); } finally @@ -299,6 +317,7 @@ public void ShowUserInterface() _lp.SignatureNotMatchingErrorText, PopupButtons.Ok), null); else + { try { UpdateManagerInstance.InstallPackage(); @@ -316,6 +335,7 @@ public void ShowUserInterface() ex, PopupButtons.Ok), null); } + } }); } finally From ae1f1a8ea5de937db8cdcf81d951c1c2f49c37ac Mon Sep 17 00:00:00 2001 From: Dominic Beger Date: Sun, 3 Sep 2017 00:30:09 +0200 Subject: [PATCH 4/6] Update version to v3.1.8 --- nUpdate.Administration/Program.cs | 2 +- nUpdate.Administration/Properties/AssemblyInfo.cs | 4 ++-- nUpdate.Administration/UI/Dialogs/InfoDialog.Designer.cs | 2 +- nUpdate.Client.GuiInterface/Properties/AssemblyInfo.cs | 2 +- nUpdate.Test/Properties/AssemblyInfo.cs | 4 ++-- nUpdate.UpdateInstaller/Properties/AssemblyInfo.cs | 4 ++-- nUpdate/Properties/AssemblyInfo.cs | 4 ++-- 7 files changed, 11 insertions(+), 11 deletions(-) diff --git a/nUpdate.Administration/Program.cs b/nUpdate.Administration/Program.cs index 41ce8c60..9314e4b6 100644 --- a/nUpdate.Administration/Program.cs +++ b/nUpdate.Administration/Program.cs @@ -54,7 +54,7 @@ public static class Program /// /// The version string shown in all dialog titles. /// - public static string VersionString => "nUpdate Administration v3.1.5"; + public static string VersionString => "nUpdate Administration v3.1.8"; public static string AesKeyPassword => "VZh7mLRPNI"; public static string AesIvPassword => "cOijH2vgwR"; diff --git a/nUpdate.Administration/Properties/AssemblyInfo.cs b/nUpdate.Administration/Properties/AssemblyInfo.cs index 50d965c1..ffa22ec9 100644 --- a/nUpdate.Administration/Properties/AssemblyInfo.cs +++ b/nUpdate.Administration/Properties/AssemblyInfo.cs @@ -38,6 +38,6 @@ // übernehmen, indem Sie "*" eingeben: // [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("3.1.5.0")] -[assembly: AssemblyFileVersion("3.1.5.0")] +[assembly: AssemblyVersion("3.1.8.0")] +[assembly: AssemblyFileVersion("3.1.8.0")] [assembly: NeutralResourcesLanguage("")] \ No newline at end of file diff --git a/nUpdate.Administration/UI/Dialogs/InfoDialog.Designer.cs b/nUpdate.Administration/UI/Dialogs/InfoDialog.Designer.cs index 18e0be94..ecde6b49 100644 --- a/nUpdate.Administration/UI/Dialogs/InfoDialog.Designer.cs +++ b/nUpdate.Administration/UI/Dialogs/InfoDialog.Designer.cs @@ -105,7 +105,7 @@ private void InitializeComponent() this.label13.Name = "label13"; this.label13.Size = new System.Drawing.Size(75, 13); this.label13.TabIndex = 20; - this.label13.Text = "v3.1.5"; + this.label13.Text = "v3.1.8"; // // controlPanel1 // diff --git a/nUpdate.Client.GuiInterface/Properties/AssemblyInfo.cs b/nUpdate.Client.GuiInterface/Properties/AssemblyInfo.cs index 6b9c9a75..b3e8e4fe 100644 --- a/nUpdate.Client.GuiInterface/Properties/AssemblyInfo.cs +++ b/nUpdate.Client.GuiInterface/Properties/AssemblyInfo.cs @@ -38,4 +38,4 @@ // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("3.1.0.0")] -[assembly: AssemblyFileVersion("3.1.5.0")] +[assembly: AssemblyFileVersion("3.1.8.0")] diff --git a/nUpdate.Test/Properties/AssemblyInfo.cs b/nUpdate.Test/Properties/AssemblyInfo.cs index 0e93446d..ad5dea81 100644 --- a/nUpdate.Test/Properties/AssemblyInfo.cs +++ b/nUpdate.Test/Properties/AssemblyInfo.cs @@ -37,5 +37,5 @@ // durch Einsatz von '*', wie in nachfolgendem Beispiel: // [Assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("3.1.5.0")] -[assembly: AssemblyFileVersion("3.1.5.0")] +[assembly: AssemblyVersion("3.1.8.0")] +[assembly: AssemblyFileVersion("3.1.8.0")] diff --git a/nUpdate.UpdateInstaller/Properties/AssemblyInfo.cs b/nUpdate.UpdateInstaller/Properties/AssemblyInfo.cs index 74c329fa..20e1d1d6 100644 --- a/nUpdate.UpdateInstaller/Properties/AssemblyInfo.cs +++ b/nUpdate.UpdateInstaller/Properties/AssemblyInfo.cs @@ -37,5 +37,5 @@ // übernehmen, indem Sie "*" eingeben: // [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("3.1.5.0")] -[assembly: AssemblyFileVersion("3.1.5.0")] +[assembly: AssemblyVersion("3.1.8.0")] +[assembly: AssemblyFileVersion("3.1.8.0")] diff --git a/nUpdate/Properties/AssemblyInfo.cs b/nUpdate/Properties/AssemblyInfo.cs index 083b3331..ec5ed094 100644 --- a/nUpdate/Properties/AssemblyInfo.cs +++ b/nUpdate/Properties/AssemblyInfo.cs @@ -37,5 +37,5 @@ // übernehmen, indem Sie "*" eingeben: // [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("3.1.5.0")] -[assembly: AssemblyFileVersion("3.1.5.0")] \ No newline at end of file +[assembly: AssemblyVersion("3.1.8.0")] +[assembly: AssemblyFileVersion("3.1.8.0")] \ No newline at end of file From 5588dcba6d136a2794acabd13f82ab8bdd89dfc1 Mon Sep 17 00:00:00 2001 From: Dominic Beger Date: Sun, 3 Sep 2017 00:30:47 +0200 Subject: [PATCH 5/6] Update version in ReadMe to v3.1.8 --- README.md | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 71cac0c3..dc5f4b10 100644 --- a/README.md +++ b/README.md @@ -2,9 +2,9 @@ # nUpdate - .NET Update Solution -[![Release](https://img.shields.io/badge/release-v3.1.5-blue.svg)](https://github.com/ProgTrade/nUpdate/releases) -[![NuGet](https://img.shields.io/badge/nuget%20nUpdate.ProvideTAP-v3.1.5-red.svg)](https://www.nuget.org/packages/nUpdate.ProvideTAP/) -[![NuGet](https://img.shields.io/badge/nuget%20nUpdate.WithoutTAP-v3.1.5-red.svg)](https://www.nuget.org/packages/nUpdate.WithoutTAP/) +[![Release](https://img.shields.io/badge/release-v3.1.8-blue.svg)](https://github.com/ProgTrade/nUpdate/releases) +[![NuGet](https://img.shields.io/badge/nuget%20nUpdate.ProvideTAP-v3.1.8-red.svg)](https://www.nuget.org/packages/nUpdate.ProvideTAP/) +[![NuGet](https://img.shields.io/badge/nuget%20nUpdate.WithoutTAP-v3.1.8-red.svg)](https://www.nuget.org/packages/nUpdate.WithoutTAP/) [![Issues](https://img.shields.io/github/issues/ProgTrade/nUpdate.svg)](https://github.com/ProgTrade/nUpdate/issues) [![GitHub license](https://img.shields.io/badge/license-MIT-blue.svg)](https://raw.githubusercontent.com/ProgTrade/nUpdate/master/LICENSE) [![Donate](https://img.shields.io/badge/Donate-PayPal-green.svg)](https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=dominic%2ebeger%40hotmail%2ede&lc=DE&item_name=nUpdate&no_note=0¤cy_code=EUR&bn=PP%2dDonationsBF%3abtn_donateCC_LG%2egif%3aNonHostedGuest) @@ -39,13 +39,13 @@ You can get the necessary libraries and applications from the current [releases] If you want to use nUpdate with the Taskbased Asynchronous Pattern including `async` and `await`, then install this package: ``` -PM> Install-Package nUpdate.ProvideTAP -Version 3.1.5 +PM> Install-Package nUpdate.ProvideTAP -Version 3.1.8 ``` Otherwise, if you want to use the Eventbased Asynchronous Pattern only, make sure to install this package: ``` -PM> Install-Package nUpdate.WithoutTAP -Version 3.1.5 +PM> Install-Package nUpdate.WithoutTAP -Version 3.1.8 ``` ## Web From ef4208c3ecd6b466b072b0a666a4cbdaa39a0260 Mon Sep 17 00:00:00 2001 From: Dominic Beger Date: Sun, 3 Sep 2017 00:33:11 +0200 Subject: [PATCH 6/6] Update installer binaries in nUpdate --- nUpdate/Resources/nUpdate UpdateInstaller.exe | Bin 115200 -> 115200 bytes nUpdate/Resources/nUpdate UpdateInstaller.pdb | Bin 124416 -> 124416 bytes 2 files changed, 0 insertions(+), 0 deletions(-) diff --git a/nUpdate/Resources/nUpdate UpdateInstaller.exe b/nUpdate/Resources/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