Skip to content

Commit

Permalink
Merge branch 'release/v3.1.8'
Browse files Browse the repository at this point in the history
  • Loading branch information
Dominic Beger committed Sep 2, 2017
2 parents be9c2b5 + ef4208c commit bd92468
Show file tree
Hide file tree
Showing 13 changed files with 84 additions and 61 deletions.
10 changes: 5 additions & 5 deletions README.md
Expand Up @@ -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&currency_code=EUR&bn=PP%2dDonationsBF%3abtn_donateCC_LG%2egif%3aNonHostedGuest)
Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion nUpdate.Administration/Program.cs
Expand Up @@ -54,7 +54,7 @@ public static class Program
/// <summary>
/// The version string shown in all dialog titles.
/// </summary>
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";
Expand Down
4 changes: 2 additions & 2 deletions nUpdate.Administration/Properties/AssemblyInfo.cs
Expand Up @@ -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("")]
2 changes: 1 addition & 1 deletion nUpdate.Administration/UI/Dialogs/InfoDialog.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion nUpdate.Client.GuiInterface/Properties/AssemblyInfo.cs
Expand Up @@ -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")]
4 changes: 2 additions & 2 deletions nUpdate.Test/Properties/AssemblyInfo.cs
Expand Up @@ -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")]
4 changes: 2 additions & 2 deletions nUpdate.UpdateInstaller/Properties/AssemblyInfo.cs
Expand Up @@ -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")]
4 changes: 2 additions & 2 deletions nUpdate/Properties/AssemblyInfo.cs
Expand Up @@ -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")]
Binary file modified nUpdate/Resources/nUpdate UpdateInstaller.exe
Binary file not shown.
Binary file modified nUpdate/Resources/nUpdate UpdateInstaller.pdb
Binary file not shown.
11 changes: 9 additions & 2 deletions nUpdate/UI/Dialogs/UpdateDownloadDialog.cs
Expand Up @@ -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)
Expand Down Expand Up @@ -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;
Expand Down
72 changes: 31 additions & 41 deletions nUpdate/Updating/UpdateManager.cs
Expand Up @@ -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();
}

/// <summary>
Expand Down Expand Up @@ -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)));
}
}
}
Expand All @@ -486,19 +478,20 @@ public void DownloadPackagesAsync()
TaskScheduler.Default);
}

#if PROVIDE_TAP /// <summary>
/// Downloads the available update packages from the server, asynchronously.
/// </summary>
/// <seealso cref="DownloadPackages" />
#if PROVIDE_TAP
/// <summary>
/// Downloads the available update packages from the server, asynchronously.
/// </summary>
/// <seealso cref="DownloadPackages" />
public async Task DownloadPackagesAsync(IProgress<UpdateDownloadProgressChangedEventArgs> progress)
{
_downloadCancellationTokenSource?.Dispose();
_downloadCancellationTokenSource = new CancellationTokenSource();

long received = 0;
var total = PackageConfigurations.Select(config => 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);
Expand Down Expand Up @@ -554,28 +547,24 @@ public async Task DownloadPackagesAsync(IProgress<UpdateDownloadProgressChangedE
await fileStream.WriteAsync(buffer, 0, size);
received += size;
progress.Report(new UpdateDownloadProgressChangedEventArgs(received,
(long) total, (float) (received/total)*100));
(long) total, (float) (received / total) * 100));
size = await input.ReadAsync(buffer, 0, buffer.Length);
}

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))
var response =
new WebClient
{
throw new StatisticsException(String.Format(
_lp.StatisticsScriptExceptionText, response));
}
}
catch (Exception ex)
Credentials =
HttpAuthenticationCredentials
}.DownloadString(
$"{updateConfiguration.UpdatePhpFileUri}?versionid={updateConfiguration.VersionId}&os={SystemInformation.OperatingSystemName}"); // Only for calling it
if (!String.IsNullOrEmpty(response))
{
throw new StatisticsException(ex.Message);
throw new StatisticsException(String.Format(
_lp.StatisticsScriptExceptionText, response));
}
}
}
Expand All @@ -587,7 +576,7 @@ public async Task DownloadPackagesAsync(IProgress<UpdateDownloadProgressChangedE
}
}


#endif

private void DownloadTaskCompleted(Task task)
Expand Down Expand Up @@ -764,6 +753,7 @@ public void InstallPackage()
Cleanup();
if (ex.NativeErrorCode != 1223)
throw;
return;
}

if (CloseHostApplication)
Expand Down
30 changes: 28 additions & 2 deletions nUpdate/Updating/UpdaterUi.cs
Expand Up @@ -9,6 +9,7 @@
using System.Windows.Forms;
using Microsoft;
using nUpdate.Core.Localization;
using nUpdate.Exceptions;
using nUpdate.UI.Dialogs;
using nUpdate.UI.Popups;
using nUpdate.UpdateEventArgs;
Expand Down Expand Up @@ -163,13 +164,17 @@ public void ShowUserInterface()
{
progressIndicator.ProgressChanged += (sender, args) =>
downloadDialog.ProgressPercentage = (int) args.Percentage;

await UpdateManagerInstance.DownloadPackagesAsync(progressIndicator);
}
catch (OperationCanceledException)
{
return;
}
catch (StatisticsException ex)
{
downloadDialog.StatisticsEntryFail(ex);
}
catch (Exception ex)
{
downloadDialog.Fail(ex);
Expand Down Expand Up @@ -205,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
Expand All @@ -223,6 +246,7 @@ public void ShowUserInterface()
UpdateManagerInstance.PackagesDownloadProgressChanged += downloadDialog.ProgressChanged;
UpdateManagerInstance.PackagesDownloadFinished += downloadDialog.Finished;
UpdateManagerInstance.PackagesDownloadFailed += downloadDialog.Failed;
UpdateManagerInstance.StatisticsEntryFailed += downloadDialog.StatisticsEntryFailed;

Task.Factory.StartNew(() =>
{
Expand Down Expand Up @@ -293,6 +317,7 @@ public void ShowUserInterface()
_lp.SignatureNotMatchingErrorText,
PopupButtons.Ok), null);
else
{
try
{
UpdateManagerInstance.InstallPackage();
Expand All @@ -310,6 +335,7 @@ public void ShowUserInterface()
ex,
PopupButtons.Ok), null);
}
}
});
}
finally
Expand Down

0 comments on commit bd92468

Please sign in to comment.