diff --git a/AltoHttp/AltoHttp.csproj b/AltoHttp/AltoHttp.csproj
index f3e691e..4650f71 100644
--- a/AltoHttp/AltoHttp.csproj
+++ b/AltoHttp/AltoHttp.csproj
@@ -8,7 +8,7 @@
Library
AltoHttp
AltoHttp
- v4.5
+ v4.8
Properties
diff --git a/AltoHttp/HttpDownloader.cs b/AltoHttp/HttpDownloader.cs
index 6e86c8c..a6c742e 100644
--- a/AltoHttp/HttpDownloader.cs
+++ b/AltoHttp/HttpDownloader.cs
@@ -208,8 +208,11 @@ public void Start()
///
public void Pause()
{
- allowDownload = false;
- downloadThread.Interrupt();
+ if (State != Status.Paused && State == Status.Downloading)
+ {
+ allowDownload = false;
+ downloadThread.Interrupt();
+ }
}
///
/// Stops the download, deletes the downloaded file and resets the download
@@ -232,23 +235,25 @@ public void StopReset()
/// The filepath to continue
public void Resume(string fileToResume, string validationChecksum)
{
- LastMD5Checksum = validationChecksum;
- if (State != Status.Paused && State != Status.ErrorOccured)
- throw new Exception("Resume is enabled only when not downloading");
- var file = new FileInfo(fileToResume);
- TotalBytesReceived = file.Length;
- if (fileToResume != FullFileName)
- File.Move(fileToResume, FullFileName);
- Start();
+ if (State == Status.Paused)
+ {
+ LastMD5Checksum = validationChecksum;
+ if (State != Status.Paused && State != Status.ErrorOccured)
+ throw new Exception("Resume is enabled only when not downloading");
+ var file = new FileInfo(fileToResume);
+ TotalBytesReceived = file.Length;
+ if (fileToResume != FullFileName)
+ File.Move(fileToResume, FullFileName);
+ Start();
+ }
}
///
/// Continues from where the file left
///
public void Resume()
{
- if (State != Status.Paused && State != Status.ErrorOccured)
- throw new Exception("Resume is enabled only when not downloading");
- Start();
+ if (State == Status.Paused)
+ Start();
}
///
/// Gets the total bytes downloaded
diff --git a/DemoApplication/DemoApplication.csproj b/DemoApplication/DemoApplication.csproj
index c804d87..7b561b0 100644
--- a/DemoApplication/DemoApplication.csproj
+++ b/DemoApplication/DemoApplication.csproj
@@ -9,7 +9,7 @@
Properties
DemoApplication
DemoApplication
- v4.5
+ v4.8
512
@@ -73,6 +73,7 @@
Resources.resx
True
+
SettingsSingleFileGenerator
diff --git a/DemoApplication/Properties/Resources.Designer.cs b/DemoApplication/Properties/Resources.Designer.cs
index f364f8b..241d32a 100644
--- a/DemoApplication/Properties/Resources.Designer.cs
+++ b/DemoApplication/Properties/Resources.Designer.cs
@@ -19,7 +19,7 @@ namespace DemoApplication.Properties {
// class via a tool like ResGen or Visual Studio.
// To add or remove a member, edit your .ResX file then rerun ResGen
// with the /str option, or rebuild your VS project.
- [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
+ [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "17.0.0.0")]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
internal class Resources {
diff --git a/DemoApplication/Properties/Settings.Designer.cs b/DemoApplication/Properties/Settings.Designer.cs
index c21edcc..94e0359 100644
--- a/DemoApplication/Properties/Settings.Designer.cs
+++ b/DemoApplication/Properties/Settings.Designer.cs
@@ -12,7 +12,7 @@ namespace DemoApplication.Properties {
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
- [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "12.0.0.0")]
+ [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "17.5.0.0")]
internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));