diff --git a/README.md b/README.md
index ec4aed75..71cac0c3 100644
--- a/README.md
+++ b/README.md
@@ -2,9 +2,9 @@
# nUpdate - .NET Update Solution
-[![Release](https://img.shields.io/badge/release-v3.1.2-blue.svg)](https://github.com/ProgTrade/nUpdate/releases)
-[![NuGet](https://img.shields.io/badge/nuget%20nUpdate.ProvideTAP-v3.1.2-red.svg)](https://www.nuget.org/packages/nUpdate.ProvideTAP/)
-[![NuGet](https://img.shields.io/badge/nuget%20nUpdate.WithoutTAP-v3.1.2-red.svg)](https://www.nuget.org/packages/nUpdate.WithoutTAP/)
+[![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/)
[![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)
@@ -28,7 +28,7 @@ Also, nUpdate is designed to fit in with all operating systems since Windows Vis
- Smart statistics about the downloads of your published updates
- Supports very large update packages
- ...
-
+
## Installation
@@ -39,15 +39,15 @@ 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.2
+PM> Install-Package nUpdate.ProvideTAP -Version 3.1.5
```
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.2
+PM> Install-Package nUpdate.WithoutTAP -Version 3.1.5
```
-
+
## Web
* [nUpdate] - The official website of nUpdate.
* [@nUpdateLib] - The official twitter account of nUpdate.
diff --git a/nUpdate.Administration/Core/Application/UpdateProject.cs b/nUpdate.Administration/Core/Application/UpdateProject.cs
index e5046b48..bfeb2412 100644
--- a/nUpdate.Administration/Core/Application/UpdateProject.cs
+++ b/nUpdate.Administration/Core/Application/UpdateProject.cs
@@ -3,12 +3,9 @@
using System;
using System.Collections.Generic;
using System.IO;
-using System.Linq;
using System.Net;
using nUpdate.Administration.Core.History;
using nUpdate.Core;
-using nUpdate.Updating;
-using Newtonsoft.Json.Linq;
using Starksoft.Aspen.Ftps;
namespace nUpdate.Administration.Core.Application
diff --git a/nUpdate.Administration/Program.cs b/nUpdate.Administration/Program.cs
index 063bc64e..41ce8c60 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.2";
+ public static string VersionString => "nUpdate Administration v3.1.5";
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 9f220e7d..50d965c1 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.2.0")]
-[assembly: AssemblyFileVersion("3.1.2.0")]
+[assembly: AssemblyVersion("3.1.5.0")]
+[assembly: AssemblyFileVersion("3.1.5.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 0567f4a4..18e0be94 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.2";
+ this.label13.Text = "v3.1.5";
//
// controlPanel1
//
diff --git a/nUpdate.Administration/UI/Dialogs/NewProjectDialog.cs b/nUpdate.Administration/UI/Dialogs/NewProjectDialog.cs
index 0ddcfa04..d8412b08 100644
--- a/nUpdate.Administration/UI/Dialogs/NewProjectDialog.cs
+++ b/nUpdate.Administration/UI/Dialogs/NewProjectDialog.cs
@@ -237,7 +237,7 @@ public void Reset()
private void NewProjectDialog_Load(object sender, EventArgs e)
{
- if (!ConnectionChecker.IsConnectionAvailable())
+ if (!ConnectionManager.IsConnectionAvailable())
{
Popup.ShowPopup(this, SystemIcons.Error, "No network connection available.",
"No active network connection was found. In order to create a project a network connection is required in order to communicate with the server.",
@@ -721,8 +721,9 @@ ON DELETE NO ACTION
string myConnectionString = null;
Invoke(new Action(() =>
{
- myConnectionString = $"SERVER={SqlWebUrl};" + $"DATABASE={SqlDatabaseName};" +
- $"UID={SqlUsername};" + $"PASSWORD={sqlPasswordTextBox.Text};";
+ myConnectionString = $"SERVER='{SqlWebUrl}';" + $"DATABASE='{SqlDatabaseName}';" +
+ $"UID='{SqlUsername}';" +
+ $"PASSWORD='{sqlPasswordTextBox.Text}';";
}));
myConnection = new MySqlConnection(myConnectionString);
diff --git a/nUpdate.Administration/UI/Dialogs/PackageAddDialog.cs b/nUpdate.Administration/UI/Dialogs/PackageAddDialog.cs
index f3745848..b7ecdbb6 100644
--- a/nUpdate.Administration/UI/Dialogs/PackageAddDialog.cs
+++ b/nUpdate.Administration/UI/Dialogs/PackageAddDialog.cs
@@ -167,14 +167,15 @@ public void Reset()
if (Project.UseStatistics)
{
Invoke(new Action(() => loadingLabel.Text = "Undoing SQL-entries..."));
- var connectionString = $"SERVER={Project.SqlWebUrl};" + $"DATABASE={Project.SqlDatabaseName};" +
- $"UID={Project.SqlUsername};" +
- $"PASSWORD={SqlPassword.ConvertToInsecureString()};";
+ var connectionString = $"SERVER='{Project.SqlWebUrl}';" + $"DATABASE='{Project.SqlDatabaseName}';" +
+ $"UID='{Project.SqlUsername}';" +
+ $"PASSWORD='{SqlPassword.ConvertToInsecureString()}';";
bool connectingFailed = false;
- var deleteConnection = new MySqlConnection(connectionString);
+ MySqlConnection deleteConnection = null;
try
{
+ deleteConnection = new MySqlConnection(connectionString);
deleteConnection.Open();
}
catch (Exception ex)
@@ -208,7 +209,7 @@ public void Reset()
}
}
- deleteConnection.Close();
+ deleteConnection?.Close();
Settings.Default.VersionID -= 1;
Settings.Default.Save();
Settings.Default.Reload();
@@ -681,10 +682,9 @@ var tabPage in
Invoke(new Action(() => loadingLabel.Text = "Connecting to SQL-server..."));
try
{
- var connectionString = $"SERVER={Project.SqlWebUrl};" +
- $"DATABASE={Project.SqlDatabaseName};" +
- $"UID={Project.SqlUsername};" +
- $"PASSWORD={SqlPassword.ConvertToInsecureString()};";
+ var connectionString = $"SERVER='{Project.SqlWebUrl}';" + $"DATABASE='{Project.SqlDatabaseName}';" +
+ $"UID='{Project.SqlUsername}';" +
+ $"PASSWORD='{SqlPassword.ConvertToInsecureString()}';";
_insertConnection = new MySqlConnection(connectionString);
_insertConnection.Open();
diff --git a/nUpdate.Administration/UI/Dialogs/PackageEditDialog.cs b/nUpdate.Administration/UI/Dialogs/PackageEditDialog.cs
index aa00d2b4..07c80907 100644
--- a/nUpdate.Administration/UI/Dialogs/PackageEditDialog.cs
+++ b/nUpdate.Administration/UI/Dialogs/PackageEditDialog.cs
@@ -155,13 +155,14 @@ public void Reset()
if (_commandsExecuted)
{
Invoke(new Action(() => loadingLabel.Text = "Connecting to SQL-server..."));
- var connectionString = $"SERVER={Project.SqlWebUrl};" + $"DATABASE={Project.SqlDatabaseName};" +
- $"UID={Project.SqlUsername};" +
- $"PASSWORD={SqlPassword.ConvertToInsecureString()};";
+ var connectionString = $"SERVER='{Project.SqlWebUrl}';" + $"DATABASE='{Project.SqlDatabaseName}';" +
+ $"UID='{Project.SqlUsername}';" +
+ $"PASSWORD='{SqlPassword.ConvertToInsecureString()}';";
- var myConnection = new MySqlConnection(connectionString);
+ MySqlConnection myConnection = null;
try
{
+ myConnection = new MySqlConnection(connectionString);
myConnection.Open();
}
catch (MySqlException ex)
@@ -171,7 +172,7 @@ public void Reset()
() =>
Popup.ShowPopup(this, SystemIcons.Error, "An MySQL-exception occured.",
ex, PopupButtons.Ok)));
- myConnection.Close();
+ myConnection?.Close();
Invoke(new Action(Close));
return;
}
@@ -182,7 +183,7 @@ public void Reset()
() =>
Popup.ShowPopup(this, SystemIcons.Error, "Error while connecting to the database.",
ex, PopupButtons.Ok)));
- myConnection.Close();
+ myConnection?.Close();
Invoke(new Action(Close));
return;
}
@@ -344,7 +345,7 @@ private void PackageEditDialog_Load(object sender, EventArgs e)
categoryTreeView.SelectedNode = categoryTreeView.Nodes[0];
if (_packageConfiguration.UnsupportedVersions != null &&
- _packageConfiguration.UnsupportedVersions.Count() != 0)
+ _packageConfiguration.UnsupportedVersions.Length != 0)
{
someVersionsRadioButton.Checked = true;
unsupportedVersionsPanel.Enabled = true;
@@ -710,13 +711,14 @@ await Task.Factory.StartNew(() =>
{
Invoke(new Action(() => loadingLabel.Text = "Connecting to SQL-server..."));
- var connectionString = $"SERVER={Project.SqlWebUrl};" + $"DATABASE={Project.SqlDatabaseName};" +
- $"UID={Project.SqlUsername};" +
- $"PASSWORD={SqlPassword.ConvertToInsecureString()};";
+ var connectionString = $"SERVER='{Project.SqlWebUrl}';" + $"DATABASE='{Project.SqlDatabaseName}';" +
+ $"UID='{Project.SqlUsername}';" +
+ $"PASSWORD='{SqlPassword.ConvertToInsecureString()}';";
- var myConnection = new MySqlConnection(connectionString);
+ MySqlConnection myConnection = null;
try
{
+ myConnection = new MySqlConnection(connectionString);
myConnection.Open();
}
catch (MySqlException ex)
@@ -726,7 +728,7 @@ await Task.Factory.StartNew(() =>
() =>
Popup.ShowPopup(this, SystemIcons.Error, "An MySQL-exception occured.",
ex, PopupButtons.Ok)));
- myConnection.Close();
+ myConnection?.Close();
Reset();
return;
}
@@ -737,7 +739,7 @@ await Task.Factory.StartNew(() =>
() =>
Popup.ShowPopup(this, SystemIcons.Error, "Error while connecting to the database.",
ex, PopupButtons.Ok)));
- myConnection.Close();
+ myConnection?.Close();
Reset();
return;
}
diff --git a/nUpdate.Administration/UI/Dialogs/ProjectDialog.cs b/nUpdate.Administration/UI/Dialogs/ProjectDialog.cs
index 623b2a69..d594cea0 100644
--- a/nUpdate.Administration/UI/Dialogs/ProjectDialog.cs
+++ b/nUpdate.Administration/UI/Dialogs/ProjectDialog.cs
@@ -4,7 +4,6 @@
using System.Collections;
using System.Collections.Generic;
using System.Data;
-using System.Diagnostics;
using System.Drawing;
using System.Globalization;
using System.IO;
@@ -114,13 +113,14 @@ public void Reset()
{
Invoke(new Action(() => loadingLabel.Text = "Connecting to MySQL-server..."));
- var connectionString = $"SERVER={Project.SqlWebUrl};" + $"DATABASE={Project.SqlDatabaseName};" +
- $"UID={Project.SqlUsername};" +
- $"PASSWORD={SqlPassword.ConvertToInsecureString()};";
+ var connectionString = $"SERVER='{Project.SqlWebUrl}';" + $"DATABASE='{Project.SqlDatabaseName}';" +
+ $"UID='{Project.SqlUsername}';" +
+ $"PASSWORD='{SqlPassword.ConvertToInsecureString()}';";
- var deleteConnection = new MySqlConnection(connectionString);
+ MySqlConnection deleteConnection = null;
try
{
+ deleteConnection = new MySqlConnection(connectionString);
deleteConnection.Open();
}
catch (MySqlException ex)
@@ -131,7 +131,7 @@ public void Reset()
Popup.ShowPopup(this, SystemIcons.Error,
"An MySQL-exception occured when trying to undo the SQL-insertions...",
ex, PopupButtons.Ok)));
- deleteConnection.Close();
+ deleteConnection?.Close();
return;
}
catch (Exception ex)
@@ -142,7 +142,7 @@ public void Reset()
Popup.ShowPopup(this, SystemIcons.Error,
"Error while connecting to the database when trying to undo the SQL-insertions...",
ex, PopupButtons.Ok)));
- deleteConnection.Close();
+ deleteConnection?.Close();
SetUiState(true);
return;
}
@@ -485,7 +485,7 @@ private async void ProjectDialog_Load(object sender, EventArgs e)
packagesList.MakeCollapsable();
statisticsDataGridView.RowHeadersVisible = false;
- if (!ConnectionChecker.IsConnectionAvailable())
+ if (!ConnectionManager.IsConnectionAvailable())
{
checkUpdateConfigurationLinkLabel.Enabled = false;
addButton.Enabled = false;
@@ -553,13 +553,13 @@ private Task InitializeStatisticsData()
statisticsStatusLabel.Text = "Gathering statistics...";
}));
- var connectionString = $"SERVER={Project.SqlWebUrl};" + $"DATABASE={Project.SqlDatabaseName};" +
- $"UID={Project.SqlUsername};" +
- $"PASSWORD={SqlPassword.ConvertToInsecureString()};";
+ var connectionString = $"SERVER='{Project.SqlWebUrl}';" + $"DATABASE='{Project.SqlDatabaseName}';" +
+ $"UID='{Project.SqlUsername}';" +
+ $"PASSWORD='{SqlPassword.ConvertToInsecureString()}';";
- _queryConnection = new MySqlConnection(connectionString);
try
{
+ _queryConnection = new MySqlConnection(connectionString);
_queryConnection.Open();
}
catch (MySqlException ex)
@@ -772,7 +772,7 @@ private void searchTextBox_KeyDown(object sender, KeyEventArgs e)
private void addButton_Click(object sender, EventArgs e)
{
- if (!ConnectionChecker.IsConnectionAvailable())
+ if (!ConnectionManager.IsConnectionAvailable())
{
Popup.ShowPopup(this, SystemIcons.Error, "No network connection available.",
"No active network connection was found. In order to add a package a network connection is required because the update configuration must be downloaded from the server.",
@@ -824,7 +824,7 @@ private async Task InitializeEditing()
return;
}
- if (!ConnectionChecker.IsConnectionAvailable() && correspondingPackage.IsReleased)
+ if (!ConnectionManager.IsConnectionAvailable() && correspondingPackage.IsReleased)
{
Popup.ShowPopup(this, SystemIcons.Error, "No network connection available.",
"No active network connection was found. In order to edit a package, which is already existing on the server, a network connection is required because the update configuration must be downloaded from the server.",
@@ -1199,13 +1199,14 @@ await TaskEx.Run(() =>
Invoke(new Action(() => loadingLabel.Text = "Connecting to SQL-server..."));
- var connectionString = $"SERVER={Project.SqlWebUrl};" + $"DATABASE={Project.SqlDatabaseName};" +
- $"UID={Project.SqlUsername};" +
- $"PASSWORD={SqlPassword.ConvertToInsecureString()};";
+ var connectionString = $"SERVER='{Project.SqlWebUrl}';" + $"DATABASE='{Project.SqlDatabaseName}';" +
+ $"UID='{Project.SqlUsername}';" +
+ $"PASSWORD='{SqlPassword.ConvertToInsecureString()}';";
- var insertConnection = new MySqlConnection(connectionString);
+ MySqlConnection insertConnection = null;
try
{
+ insertConnection = new MySqlConnection(connectionString);
insertConnection.Open();
}
catch (MySqlException ex)
@@ -1215,7 +1216,7 @@ await TaskEx.Run(() =>
() =>
Popup.ShowPopup(this, SystemIcons.Error, "An MySQL-exception occured.",
ex, PopupButtons.Ok)));
- insertConnection.Close();
+ insertConnection?.Close();
SetUiState(true);
return;
}
@@ -1226,7 +1227,7 @@ await TaskEx.Run(() =>
() =>
Popup.ShowPopup(this, SystemIcons.Error, "Error while connecting to the database.",
ex, PopupButtons.Ok)));
- insertConnection.Close();
+ insertConnection?.Close();
SetUiState(true);
return;
}
@@ -1429,7 +1430,7 @@ private async void checkUpdateConfigurationLinkLabel_LinkClicked(object sender,
private async void CheckUpdateConfigurationStatus(Uri configFileUri)
{
- if (!ConnectionChecker.IsConnectionAvailable())
+ if (!ConnectionManager.IsConnectionAvailable())
{
Invoke(
new Action(
@@ -1700,7 +1701,7 @@ var directoryInfo in
private bool _shouldKeepErrorsSecret;
- private void deleteButton_Click(object sender, EventArgs e)
+ private async void deleteButton_Click(object sender, EventArgs e)
{
if (packagesList.SelectedItems.Count == 0)
return;
@@ -1711,7 +1712,7 @@ private void deleteButton_Click(object sender, EventArgs e)
if (answer != DialogResult.Yes)
return;
- DeletePackage();
+ await DeletePackage();
}
///
@@ -1755,7 +1756,11 @@ private Task DeletePackage()
{
updateConfig.Remove(
updateConfig.First(
- item => item.LiteralVersion == (string) ((ListViewItem) enumerator.Current).Tag));
+ item =>
+ {
+ var listViewItem = (ListViewItem) enumerator.Current;
+ return listViewItem != null && item.LiteralVersion == (string) listViewItem.Tag;
+ }));
}
catch
{
@@ -1820,7 +1825,7 @@ private Task DeletePackage()
var selectedItem = (ListViewItem) enumerator.Current;
ListViewGroup releasedGroup = null;
Invoke(new Action(() => releasedGroup = packagesList.Groups[0]));
- if (selectedItem.Group == releasedGroup) // Must be deleted online, too.
+ if (selectedItem != null && selectedItem.Group == releasedGroup) // Must be deleted online, too.
{
Invoke(
new Action(
@@ -1863,9 +1868,10 @@ private Task DeletePackage()
try
{
- Directory.Delete(
- Path.Combine(Program.Path, "Projects", Project.Name, selectedItem.Tag.ToString()),
- true);
+ if (selectedItem != null)
+ Directory.Delete(
+ Path.Combine(Program.Path, "Projects", Project.Name, selectedItem.Tag.ToString()),
+ true);
}
catch (Exception ex)
{
@@ -1898,7 +1904,11 @@ private Task DeletePackage()
Project.Packages.Remove(
Project.Packages.First(
- item => item.Version == (string) ((ListViewItem) enumerator.Current).Tag));
+ item =>
+ {
+ var listViewItem = (ListViewItem) enumerator.Current;
+ return listViewItem != null && item.Version == (string) listViewItem.Tag;
+ }));
UpdateProject.SaveProject(Project.Path, Project);
}
catch (Exception ex)
@@ -1918,14 +1928,14 @@ private Task DeletePackage()
new Action(
() => loadingLabel.Text = "Connecting to SQL-server..."));
- var connectionString = $"SERVER={Project.SqlWebUrl};" + $"DATABASE={Project.SqlDatabaseName};" +
- $"UID={Project.SqlUsername};" +
- $"PASSWORD={SqlPassword.ConvertToInsecureString()};";
-
- var deleteConnection = new MySqlConnection(connectionString);
+ var connectionString = $"SERVER='{Project.SqlWebUrl}';" + $"DATABASE='{Project.SqlDatabaseName}';" +
+ $"UID='{Project.SqlUsername}';" +
+ $"PASSWORD='{SqlPassword.ConvertToInsecureString()}';";
+ MySqlConnection deleteConnection = null;
try
{
+ deleteConnection = new MySqlConnection(connectionString);
deleteConnection.Open();
}
catch (MySqlException ex)
@@ -1935,7 +1945,7 @@ private Task DeletePackage()
() =>
Popup.ShowPopup(this, SystemIcons.Error, "An MySQL-exception occured.",
ex, PopupButtons.Ok)));
- deleteConnection.Close();
+ deleteConnection?.Close();
SetUiState(true);
return;
}
@@ -1947,7 +1957,7 @@ private Task DeletePackage()
Popup.ShowPopup(this, SystemIcons.Error,
"Error while connecting to the database.",
ex, PopupButtons.Ok)));
- deleteConnection.Close();
+ deleteConnection?.Close();
SetUiState(true);
return;
}
@@ -1957,8 +1967,9 @@ private Task DeletePackage()
() => loadingLabel.Text = "Executing SQL-commands..."));
var queryCommand = deleteConnection.CreateCommand();
- queryCommand.CommandText =
- $"SELECT `ID` FROM `Version` WHERE `Version` = \"{selectedItem.Tag}\"";
+ if (selectedItem != null)
+ queryCommand.CommandText =
+ $"SELECT `ID` FROM `Version` WHERE `Version` = \"{selectedItem.Tag}\"";
int versionId;
MySqlDataReader dataReader = null;
@@ -2010,7 +2021,8 @@ private Task DeletePackage()
}
}
- _updateLog.Write(LogEntry.Delete, new UpdateVersion((string) selectedItem.Tag).FullText);
+ if (selectedItem != null)
+ _updateLog.Write(LogEntry.Delete, new UpdateVersion((string) selectedItem.Tag).FullText);
}
SetUiState(true);
diff --git a/nUpdate.Administration/UI/Dialogs/ProjectEditDialog.cs b/nUpdate.Administration/UI/Dialogs/ProjectEditDialog.cs
index 3d9f66c0..eb9b8bb8 100644
--- a/nUpdate.Administration/UI/Dialogs/ProjectEditDialog.cs
+++ b/nUpdate.Administration/UI/Dialogs/ProjectEditDialog.cs
@@ -460,8 +460,9 @@ var updateConfig in
string myConnectionString = null;
Invoke(new Action(() =>
{
- myConnectionString = $"SERVER={SqlWebUrl};" + $"DATABASE={SqlDatabaseName};" +
- $"UID={SqlUsername};" + $"PASSWORD={sqlPasswordTextBox.Text};";
+ myConnectionString = $"SERVER='{SqlWebUrl}';" + $"DATABASE='{SqlDatabaseName}';" +
+ $"UID='{SqlUsername}';" +
+ $"PASSWORD='{sqlPasswordTextBox.Text}';";
}));
myConnection = new MySqlConnection(myConnectionString);
@@ -474,7 +475,7 @@ var updateConfig in
() =>
Popup.ShowPopup(this, SystemIcons.Error, "An MySQL-exception occured.",
ex, PopupButtons.Ok)));
- myConnection.Close();
+ myConnection?.Close();
Invoke(new Action(Close));
return;
}
@@ -485,7 +486,7 @@ var updateConfig in
() =>
Popup.ShowPopup(this, SystemIcons.Error, "Error while connecting to the database.",
ex, PopupButtons.Ok)));
- myConnection.Close();
+ myConnection?.Close();
Invoke(new Action(Close));
return;
}
@@ -599,8 +600,9 @@ var updateConfig in
string myConnectionString = null;
Invoke(new Action(() =>
{
- myConnectionString = $"SERVER={SqlWebUrl};" + $"DATABASE={SqlDatabaseName};" +
- $"UID={SqlUsername};" + $"PASSWORD={sqlPasswordTextBox.Text};";
+ myConnectionString = $"SERVER='{SqlWebUrl}';" + $"DATABASE='{SqlDatabaseName}';" +
+ $"UID='{SqlUsername}';" +
+ $"PASSWORD='{sqlPasswordTextBox.Text}';";
}));
myConnection = new MySqlConnection(myConnectionString);
@@ -613,7 +615,7 @@ var updateConfig in
() =>
Popup.ShowPopup(this, SystemIcons.Error, "An MySQL-exception occured.",
ex, PopupButtons.Ok)));
- myConnection.Close();
+ myConnection?.Close();
Invoke(new Action(Close));
return;
}
@@ -624,7 +626,7 @@ var updateConfig in
() =>
Popup.ShowPopup(this, SystemIcons.Error, "Error while connecting to the database.",
ex, PopupButtons.Ok)));
- myConnection.Close();
+ myConnection?.Close();
Invoke(new Action(Close));
return;
}
@@ -701,7 +703,7 @@ var updateConfig in
private void ProjectEditDialog_Load(object sender, EventArgs e)
{
- if (!ConnectionChecker.IsConnectionAvailable())
+ if (!ConnectionManager.IsConnectionAvailable())
{
Popup.ShowPopup(this, SystemIcons.Error, "No network connection available.",
"No active network connection was found. In order to edit a project a network connection is required in order to communicate with the server.",
@@ -906,7 +908,7 @@ private void continueButton_Click(object sender, EventArgs e)
{
if (useStatisticsServerRadioButton.Checked)
{
- if ((Project.SqlDatabaseName == null && SqlDatabaseName == null) ||
+ if (Project.SqlDatabaseName == null && SqlDatabaseName == null ||
string.IsNullOrWhiteSpace(sqlPasswordTextBox.Text))
{
Popup.ShowPopup(this, SystemIcons.Error, "Missing information found.",
@@ -1326,13 +1328,15 @@ var updateConfig in
string myConnectionString = null;
Invoke(new Action(() =>
{
- myConnectionString = $"SERVER={SqlWebUrl};" + $"DATABASE={SqlDatabaseName};" +
- $"UID={SqlUsername};" + $"PASSWORD={sqlPasswordTextBox.Text};";
+ myConnectionString = $"SERVER='{SqlWebUrl}';" + $"DATABASE='{SqlDatabaseName}';" +
+ $"UID='{SqlUsername}';" +
+ $"PASSWORD='{sqlPasswordTextBox.Text}';";
}));
- var myConnection = new MySqlConnection(myConnectionString);
+ MySqlConnection myConnection = null;
try
{
+ myConnection = new MySqlConnection(myConnectionString);
myConnection.Open();
}
catch (MySqlException ex)
@@ -1342,7 +1346,7 @@ var updateConfig in
() =>
Popup.ShowPopup(this, SystemIcons.Error, "An MySQL-exception occured.",
ex, PopupButtons.Ok)));
- myConnection.Close();
+ myConnection?.Close();
Reset();
return;
}
@@ -1353,7 +1357,7 @@ var updateConfig in
() =>
Popup.ShowPopup(this, SystemIcons.Error, "Error while connecting to the database.",
ex, PopupButtons.Ok)));
- myConnection.Close();
+ myConnection?.Close();
Reset();
return;
}
@@ -1498,10 +1502,10 @@ var updateConfig in
string myConnectionString = null;
Invoke(new Action(() =>
{
- myConnectionString = $"SERVER={Project.SqlWebUrl};" +
- $"DATABASE={Project.SqlDatabaseName};" +
- $"UID={Project.SqlUsername};" +
- $"PASSWORD={SqlPassword.ConvertToInsecureString()};";
+ myConnectionString =
+ $"SERVER='{Project.SqlWebUrl}';" + $"DATABASE='{Project.SqlDatabaseName}';" +
+ $"UID='{Project.SqlUsername}';" +
+ $"PASSWORD='{SqlPassword.ConvertToInsecureString()}';";
}));
myConnection = new MySqlConnection(myConnectionString);
@@ -1512,25 +1516,28 @@ var updateConfig in
Invoke(
new Action(
() =>
- Popup.ShowPopup(this, SystemIcons.Error, "An MySQL-exception occured.",
- ex, PopupButtons.Ok)));
- if (myConnection != null)
- myConnection.Close();
- Reset();
- return;
+ {
+ Popup.ShowPopup(this, SystemIcons.Warning,
+ "An MySQL-exception occured. The database data could not be removed automatically.",
+ ex, PopupButtons.Ok);
+ }));
+ goto saveData;
}
catch (Exception ex)
{
Invoke(
new Action(
() =>
- Popup.ShowPopup(this, SystemIcons.Error,
- "Error while connecting to the database.",
- ex, PopupButtons.Ok)));
- if (myConnection != null)
- myConnection.Close();
- Reset();
- return;
+ {
+ Popup.ShowPopup(this, SystemIcons.Warning,
+ "Error while connecting to the database. The database data could not be removed automatically.",
+ ex, PopupButtons.Ok);
+ }));
+ goto saveData;
+ }
+ finally
+ {
+ myConnection?.Close();
}
Invoke(
@@ -1538,11 +1545,12 @@ var updateConfig in
() =>
loadingLabel.Text = "Executing setup commands..."));
- var command = myConnection.CreateCommand();
- command.CommandText = setupString;
+ MySqlCommand command = null;
try
{
+ command = myConnection.CreateCommand();
+ command.CommandText = setupString;
command.ExecuteNonQuery();
_sqlDataDeleted = true;
}
@@ -1551,19 +1559,22 @@ var updateConfig in
Invoke(
new Action(
() =>
- Popup.ShowPopup(this, SystemIcons.Error, "Error while executing the commands.",
+ Popup.ShowPopup(this, SystemIcons.Error,
+ "Error while executing the commands. The database data could not be removed automatically.",
ex, PopupButtons.Ok)));
- Reset();
- return;
+ //Reset();
}
finally
{
myConnection.Close();
- command.Dispose();
+ command?.Dispose();
}
}
}
+ // Save the project data
+ saveData:
+
Project.Name = _name;
Project.Path = _localPath;
Project.UpdateUrl = _updateUrl;
@@ -1788,8 +1799,7 @@ private void useStatisticsServerRadioButton_CheckedChanged(object sender, EventA
if (_isSetByUser)
{
var packagesToAffectDialog = new PackagesToAffectDialog();
- if (!_useStatistics && useStatisticsServerRadioButton.Checked &&
- (Project.Packages != null && Project.Packages.Count != 0))
+ if (!_useStatistics && useStatisticsServerRadioButton.Checked && Project.Packages != null && Project.Packages.Count != 0)
{
foreach (var existingPackage in Project.Packages)
{
@@ -1855,7 +1865,7 @@ private void doNotUseProxyRadioButton_CheckedChanged(object sender, EventArgs e)
private void ftpProtocolComboBox_SelectedIndexChanged(object sender, EventArgs e)
{
- if (!_isSetByUser || (ftpProtocolComboBox.SelectedIndex != ftpProtocolComboBox.Items.Count - 1))
+ if (!_isSetByUser || ftpProtocolComboBox.SelectedIndex != ftpProtocolComboBox.Items.Count - 1)
return;
var ftpAssemblyInputDialog = new FtpAssemblyInputDialog();
if (ftpAssemblyInputDialog.ShowDialog() == DialogResult.Cancel)
diff --git a/nUpdate.Client.GuiInterface/Properties/AssemblyInfo.cs b/nUpdate.Client.GuiInterface/Properties/AssemblyInfo.cs
index 7ae90c06..6b9c9a75 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.2.0")]
\ No newline at end of file
+[assembly: AssemblyFileVersion("3.1.5.0")]
diff --git a/nUpdate.Test/ConnectionCheckerTest.cs b/nUpdate.Test/ConnectionCheckerTest.cs
index ec5e13e9..883069ff 100644
--- a/nUpdate.Test/ConnectionCheckerTest.cs
+++ b/nUpdate.Test/ConnectionCheckerTest.cs
@@ -14,7 +14,7 @@ public class ConnectionCheckerTest
[TestMethod]
public void CanReturnConnectionStatus()
{
- Assert.IsTrue(ConnectionChecker.IsConnectionAvailable());
+ Assert.IsTrue(ConnectionManager.IsConnectionAvailable());
}
}
}
\ No newline at end of file
diff --git a/nUpdate.Test/Properties/AssemblyInfo.cs b/nUpdate.Test/Properties/AssemblyInfo.cs
index 7a1211d8..0e93446d 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.2.0")]
-[assembly: AssemblyFileVersion("3.1.2.0")]
\ No newline at end of file
+[assembly: AssemblyVersion("3.1.5.0")]
+[assembly: AssemblyFileVersion("3.1.5.0")]
diff --git a/nUpdate.UpdateInstaller/Properties/AssemblyInfo.cs b/nUpdate.UpdateInstaller/Properties/AssemblyInfo.cs
index 892414f3..74c329fa 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.2.0")]
-[assembly: AssemblyFileVersion("3.1.2.0")]
\ No newline at end of file
+[assembly: AssemblyVersion("3.1.5.0")]
+[assembly: AssemblyFileVersion("3.1.5.0")]
diff --git a/nUpdate.UserInterfaceTest/MainDialog.cs b/nUpdate.UserInterfaceTest/MainDialog.cs
index dc30a969..4bca7107 100644
--- a/nUpdate.UserInterfaceTest/MainDialog.cs
+++ b/nUpdate.UserInterfaceTest/MainDialog.cs
@@ -1,6 +1,5 @@
using System;
using System.Globalization;
-using System.Net;
using System.Threading;
using System.Windows.Forms;
using nUpdate.Updating;
@@ -16,7 +15,7 @@ public MainDialog()
private void updateButton_Click(object sender, EventArgs e)
{
- var manager = new UpdateManager(new Uri("https://www.nupdate.net/updates.json"), "pYYHTtXdJyf8L3qVO6iFmJqV2DcRB5rQwEEVvu+DfdmD1VmcWToxCsSsSx/bCQfayjnH0G3eGexWZtNhNG5zEx9phjIfYuK5L6+I8qC20IFU2sg9VQiPRMJRYRd9W5d9T+jLTrs3iXhXKqDoT/Nj1lgSNduYBiLtKk+B4JJjGPVi5bysVCPJyLU3XEL2Ks2ZhWj2tdZddQsVESno2S1umCXo+AWXxmBZTukl10VUQ3d2lHv/BVVAGsuFKTy8CzEd02WxFY4OA0LbXOIMxtLwXvlEnTlKp0/zDnk2saqNr+i5oxWWlUO3WuIPY+0bGmVcyP48di8tLTtqR0KE6pRKt8uWqckabXn9zyQxYhXNBkciBswhidnSkuBTBTkpnB7IreYCPm7mr0jk1W79jjg+BIUX/BpLM0C9Qpgl7kLmm6Mg/YEwFX1nbPlANqpHdbvi1qM05Cj29WG/tTXgBcSBrUibnJZkv+iJbuQGnfwz5a2ySzGwxOi/Xj6nNL1kKpmS85ZPEspUbxwnLGAyrI1yjj6IMedryW83wCpvgtHKxS3EO5gV6Kj4Orftfkz57zHvgGDTOmQgTFcHQ4CahZ11fTYYvYAvKms/2BAZYoIA/kg9fIYdQSjQLFfI+wntV7cOeKHeMLP77p2xpSK0jqns2dd+EifrbRg9uUEpHESanO3DH0qVmofpQ8SXMKaCOsNmnSIbI1+4Bk/B+Hb3ExFA4lpmlIT5wSGtKty+gJqYIviHYfFnoEt+HjSIKKis/fi6xeQz8kS5N/n4qMKVO/Cz6SbrZ0nCEaIMAjSf2zX9q9YbNoGiETSWb3R8M2SiBhq8zvr/TFO32bHw58xjR0yqBXb5z+y0eU62bvUvDIcWfwzkGcxM2Sr0tYPgkJWU8MW6nrtiX5oGA8xyAHs63CL6XVAo/fbS3KYq2o9PSStLARiExyiBzMeEoFguLTYeD2/XC3/QRcsQJS9G4Gb9N6yhjD+OWJSr4dPz2kVKyFXetkFtDBjecXXsms5UlMTiWalK64jEF4mlOZhqwcZ511m/5qpLaL2MPM3JHkgTB/p3+lYnGZY6f+mhU+ZiAxxK8g4pG+CTmUYDczzJMJRXXWiXFJ/bHX6XTp0p9BmI4qH0/l1VMXs07UxkZnWd9cX4m0+/w9UhkFIhYib4auKYDqFaC+ee6owFTUPTTOwkNIYkC9PSOrYcXDu+lLzOEL/JmA0GobyCpQuLZs2RwOU9B2/UijygOKvXyJhw31UAHHQBGLOYZgwhn0WPQkD5szYinORnrVyiFQKLCq1uTJdMbAyodItwLKIa/hg18Pi6eLp8NUzirfe1qo0p3QNImodgZvY/mWkH5gxmTYg58Y5jWkOWgw==AQAB", new CultureInfo("zh-CN"), new UpdateVersion("1.0"));
+ var manager = new UpdateManager(new Uri("https://www.nupdate.net/test/updates.json"), "pYYHTtXdJyf8L3qVO6iFmJqV2DcRB5rQwEEVvu+DfdmD1VmcWToxCsSsSx/bCQfayjnH0G3eGexWZtNhNG5zEx9phjIfYuK5L6+I8qC20IFU2sg9VQiPRMJRYRd9W5d9T+jLTrs3iXhXKqDoT/Nj1lgSNduYBiLtKk+B4JJjGPVi5bysVCPJyLU3XEL2Ks2ZhWj2tdZddQsVESno2S1umCXo+AWXxmBZTukl10VUQ3d2lHv/BVVAGsuFKTy8CzEd02WxFY4OA0LbXOIMxtLwXvlEnTlKp0/zDnk2saqNr+i5oxWWlUO3WuIPY+0bGmVcyP48di8tLTtqR0KE6pRKt8uWqckabXn9zyQxYhXNBkciBswhidnSkuBTBTkpnB7IreYCPm7mr0jk1W79jjg+BIUX/BpLM0C9Qpgl7kLmm6Mg/YEwFX1nbPlANqpHdbvi1qM05Cj29WG/tTXgBcSBrUibnJZkv+iJbuQGnfwz5a2ySzGwxOi/Xj6nNL1kKpmS85ZPEspUbxwnLGAyrI1yjj6IMedryW83wCpvgtHKxS3EO5gV6Kj4Orftfkz57zHvgGDTOmQgTFcHQ4CahZ11fTYYvYAvKms/2BAZYoIA/kg9fIYdQSjQLFfI+wntV7cOeKHeMLP77p2xpSK0jqns2dd+EifrbRg9uUEpHESanO3DH0qVmofpQ8SXMKaCOsNmnSIbI1+4Bk/B+Hb3ExFA4lpmlIT5wSGtKty+gJqYIviHYfFnoEt+HjSIKKis/fi6xeQz8kS5N/n4qMKVO/Cz6SbrZ0nCEaIMAjSf2zX9q9YbNoGiETSWb3R8M2SiBhq8zvr/TFO32bHw58xjR0yqBXb5z+y0eU62bvUvDIcWfwzkGcxM2Sr0tYPgkJWU8MW6nrtiX5oGA8xyAHs63CL6XVAo/fbS3KYq2o9PSStLARiExyiBzMeEoFguLTYeD2/XC3/QRcsQJS9G4Gb9N6yhjD+OWJSr4dPz2kVKyFXetkFtDBjecXXsms5UlMTiWalK64jEF4mlOZhqwcZ511m/5qpLaL2MPM3JHkgTB/p3+lYnGZY6f+mhU+ZiAxxK8g4pG+CTmUYDczzJMJRXXWiXFJ/bHX6XTp0p9BmI4qH0/l1VMXs07UxkZnWd9cX4m0+/w9UhkFIhYib4auKYDqFaC+ee6owFTUPTTOwkNIYkC9PSOrYcXDu+lLzOEL/JmA0GobyCpQuLZs2RwOU9B2/UijygOKvXyJhw31UAHHQBGLOYZgwhn0WPQkD5szYinORnrVyiFQKLCq1uTJdMbAyodItwLKIa/hg18Pi6eLp8NUzirfe1qo0p3QNImodgZvY/mWkH5gxmTYg58Y5jWkOWgw==AQAB", new CultureInfo("zh-CN"), new UpdateVersion("1.0"));
// manager.HttpAuthenticationCredentials = new NetworkCredential("trade", "test123");
new UpdaterUI(manager, SynchronizationContext.Current).ShowUserInterface();
}
diff --git a/nUpdate/Core/ConnectionChecker.cs b/nUpdate/Core/ConnectionManager.cs
similarity index 53%
rename from nUpdate/Core/ConnectionChecker.cs
rename to nUpdate/Core/ConnectionManager.cs
index e2abedcb..7740a4a0 100644
--- a/nUpdate/Core/ConnectionChecker.cs
+++ b/nUpdate/Core/ConnectionManager.cs
@@ -4,12 +4,8 @@
namespace nUpdate.Core
{
- public class ConnectionChecker
+ public class ConnectionManager
{
- ///
- /// Checks if an internet connection is available.
- ///
- /// This function returns if a internet connection is available.
public static bool IsConnectionAvailable()
{
int desc;
diff --git a/nUpdate/Core/IconHelper.cs b/nUpdate/Core/IconHelper.cs
index c85b4982..03f6c272 100644
--- a/nUpdate/Core/IconHelper.cs
+++ b/nUpdate/Core/IconHelper.cs
@@ -27,7 +27,7 @@ internal static Icon ExtractAssociatedIcon(string filePath)
Uri uri;
if (filePath == null)
- throw new ArgumentException($"'{"null"}' is not valid for '{"filePath"}'", nameof(filePath));
+ throw new ArgumentException("\'null\' is not valid for \'filePath\'", nameof(filePath));
try
{
diff --git a/nUpdate/Core/SizeHelper.cs b/nUpdate/Core/SizeHelper.cs
index c534b579..335a87f5 100644
--- a/nUpdate/Core/SizeHelper.cs
+++ b/nUpdate/Core/SizeHelper.cs
@@ -2,27 +2,18 @@
using System;
using System.IO;
+using System.Text;
+using nUpdate.Core.Win32;
namespace nUpdate.Core
{
public class SizeHelper
{
- private const float GB = 1073741824;
- private const int MB = 1048576;
- private const int KB = 1024;
-
- public static Tuple ConvertSize(double packageSize)
+ public static string ConvertSize(long packageSize)
{
- if (packageSize >= GB / 10)
- return new Tuple(Math.Round(packageSize / GB, 1), "GB");
- if (packageSize >= MB / 10)
- return new Tuple(Math.Round(packageSize / MB, 1), "MB");
- if (packageSize >= KB / 10)
- return new Tuple(Math.Round(packageSize / KB, 1), "KB");
- if (packageSize >= 1)
- return new Tuple(packageSize, "B");
-
- return new Tuple(double.NaN, "NaN");
+ var sb = new StringBuilder(20);
+ NativeMethods.StrFormatByteSize(packageSize, sb, 20);
+ return sb.ToString();
}
public static bool HasEnoughSpace(double packageSize, out double necessaryBytesToFree)
diff --git a/nUpdate/Core/Win32/NativeMethods.cs b/nUpdate/Core/Win32/NativeMethods.cs
index 1553b8de..13ed42be 100644
--- a/nUpdate/Core/Win32/NativeMethods.cs
+++ b/nUpdate/Core/Win32/NativeMethods.cs
@@ -16,5 +16,9 @@ internal class NativeMethods
[DllImport("user32.dll")]
internal static extern IntPtr SendMessage(IntPtr hWnd, uint msg, IntPtr wParam, IntPtr lParam);
+
+ [DllImport("Shlwapi.dll", CharSet = CharSet.Auto)]
+ public static extern int StrFormatByteSize(long fileSize,
+ [MarshalAs(UnmanagedType.LPTStr)] StringBuilder buffer, int bufferSize);
}
}
\ No newline at end of file
diff --git a/nUpdate/Properties/AssemblyInfo.cs b/nUpdate/Properties/AssemblyInfo.cs
index ac1606ca..083b3331 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.2.0")]
-[assembly: AssemblyFileVersion("3.1.2.0")]
\ No newline at end of file
+[assembly: AssemblyVersion("3.1.5.0")]
+[assembly: AssemblyFileVersion("3.1.5.0")]
\ No newline at end of file
diff --git a/nUpdate/Resources/nUpdate UpdateInstaller.exe b/nUpdate/Resources/nUpdate UpdateInstaller.exe
index 6b1a8fe8..8dd62a0b 100644
Binary files a/nUpdate/Resources/nUpdate UpdateInstaller.exe and b/nUpdate/Resources/nUpdate UpdateInstaller.exe differ
diff --git a/nUpdate/Resources/nUpdate UpdateInstaller.pdb b/nUpdate/Resources/nUpdate UpdateInstaller.pdb
index fcccf559..293ed682 100644
Binary files a/nUpdate/Resources/nUpdate UpdateInstaller.pdb and b/nUpdate/Resources/nUpdate UpdateInstaller.pdb differ
diff --git a/nUpdate/UI/Dialogs/NewUpdateDialog.cs b/nUpdate/UI/Dialogs/NewUpdateDialog.cs
index b2a67f04..d789d4a3 100644
--- a/nUpdate/UI/Dialogs/NewUpdateDialog.cs
+++ b/nUpdate/UI/Dialogs/NewUpdateDialog.cs
@@ -55,10 +55,10 @@ private void installButton_Click(object sender, EventArgs e)
double necessarySpaceToFree;
if (!SizeHelper.HasEnoughSpace(Updater.TotalSize, out necessarySpaceToFree))
{
- var packageSizeData = SizeHelper.ConvertSize(Updater.TotalSize);
- var spaceToFreeData = SizeHelper.ConvertSize(necessarySpaceToFree);
+ var packageSizeString = SizeHelper.ConvertSize((long)Updater.TotalSize);
+ var spaceToFreeString = SizeHelper.ConvertSize((long)necessarySpaceToFree);
Popup.ShowPopup(this, SystemIcons.Warning, "Not enough disk space.",
- $"You don't have enough disk space left on your drive and nUpdate is not able to download and install the available updates ({packageSizeData.Item1} {packageSizeData.Item2}). Please free a minimum of {spaceToFreeData.Item1} {spaceToFreeData.Item2} to make sure the updates can be downloaded and installed without any problems.",
+ $"You don't have enough disk space left on your drive and nUpdate is not able to download and install the available updates ({packageSizeString}). Please free a minimum of {spaceToFreeString} to make sure the updates can be downloaded and installed without any problems.",
PopupButtons.Ok);
return;
}
@@ -96,8 +96,8 @@ private void NewUpdateDialog_Load(object sender, EventArgs e)
cancelButton.Text = _lp.CancelButtonText;
installButton.Text = _lp.InstallButtonText;
- var size = SizeHelper.ConvertSize(Updater.TotalSize);
- updateSizeLabel.Text = $"{string.Format(_lp.NewUpdateDialogSizeText, size.Item1)} {size.Item2}";
+ var size = SizeHelper.ConvertSize((long)Updater.TotalSize);
+ updateSizeLabel.Text = $"{string.Format(_lp.NewUpdateDialogSizeText, size)}";
Icon = _appIcon;
Text = Application.ProductName;
diff --git a/nUpdate/Updating/UpdateManager.cs b/nUpdate/Updating/UpdateManager.cs
index c03fa287..f37d8a29 100644
--- a/nUpdate/Updating/UpdateManager.cs
+++ b/nUpdate/Updating/UpdateManager.cs
@@ -289,7 +289,8 @@ public bool SearchForUpdates()
_searchCancellationTokenSource?.Dispose();
_searchCancellationTokenSource = new CancellationTokenSource();
- if (!ConnectionChecker.IsConnectionAvailable())
+ OnUpdateSearchStarted(this, EventArgs.Empty);
+ if (!ConnectionManager.IsConnectionAvailable())
return false;
// Check for SSL and ignore it
@@ -381,6 +382,8 @@ public void DownloadPackages()
_downloadCancellationTokenSource?.Dispose();
_downloadCancellationTokenSource = new CancellationTokenSource();
+ OnUpdateDownloadStarted(this, EventArgs.Empty);
+
long received = 0;
var total = PackageConfigurations.Select(config => GetUpdatePackageSize(config.UpdatePackageUri))
.Where(updatePackageSize => updatePackageSize != null)
@@ -458,6 +461,7 @@ public void DownloadPackages()
}
catch (Exception ex)
{
+ OnStatisticsEntryFailed(ex);
throw new StatisticsException(ex.Message);
}
}
diff --git a/nUpdate/nUpdate.csproj b/nUpdate/nUpdate.csproj
index e956fff8..75af4da1 100644
--- a/nUpdate/nUpdate.csproj
+++ b/nUpdate/nUpdate.csproj
@@ -134,7 +134,7 @@
Form
-
+
Form