Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion AltoHttp/AltoHttp.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<OutputType>Library</OutputType>
<RootNamespace>AltoHttp</RootNamespace>
<AssemblyName>AltoHttp</AssemblyName>
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
<TargetFrameworkVersion>v4.8</TargetFrameworkVersion>
<AppDesignerFolder>Properties</AppDesignerFolder>
<TargetFrameworkProfile />
</PropertyGroup>
Expand Down
31 changes: 18 additions & 13 deletions AltoHttp/HttpDownloader.cs
Original file line number Diff line number Diff line change
Expand Up @@ -208,8 +208,11 @@ public void Start()
/// </summary>
public void Pause()
{
allowDownload = false;
downloadThread.Interrupt();
if (State != Status.Paused && State == Status.Downloading)
{
allowDownload = false;
downloadThread.Interrupt();
}
}
/// <summary>
/// Stops the download, deletes the downloaded file and resets the download
Expand All @@ -232,23 +235,25 @@ public void StopReset()
/// <param name="fileToResume">The filepath to continue</param>
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();
}
}
/// <summary>
/// Continues from where the file left
/// </summary>
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();
}
/// <summary>
/// Gets the total bytes downloaded
Expand Down
3 changes: 2 additions & 1 deletion DemoApplication/DemoApplication.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>DemoApplication</RootNamespace>
<AssemblyName>DemoApplication</AssemblyName>
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
<TargetFrameworkVersion>v4.8</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<TargetFrameworkProfile />
</PropertyGroup>
Expand Down Expand Up @@ -73,6 +73,7 @@
<DependentUpon>Resources.resx</DependentUpon>
<DesignTime>True</DesignTime>
</Compile>
<None Include="app.config" />
<None Include="packages.config" />
<None Include="Properties\Settings.settings">
<Generator>SettingsSingleFileGenerator</Generator>
Expand Down
2 changes: 1 addition & 1 deletion DemoApplication/Properties/Resources.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 DemoApplication/Properties/Settings.Designer.cs

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