-
Notifications
You must be signed in to change notification settings - Fork 24
Change to resume incomplete download, even if the application is closed. #17
Copy link
Copy link
Open
Description
- I can't push this changes, so...
Small change that allows you to resume a download, even after the application has been completely closed.
//Get the download headers if not exists
if (Info == null)
{
State = Status.GettingHeaders;
GetHeaders();
aop.Post(delegate { DownloadInfoReceived.Raise(this, EventArgs.Empty); }, null);
Thread.Sleep(500); //Required to wait for the DownloadInfoReceived event to finish.
}
//Get the Bytes Received before start download, and check if the file on disk is incomplete
FileInfo fileInfo = new FileInfo(FullFileName);
if (fileInfo.Exists)
if (fileInfo.Length <= Info.Length)
TotalBytesReceived = fileInfo.Length;
In FileHelper Class, you can append file without checksum
if (!string.IsNullOrEmpty(lastChecksum))
{
var currentChecksum = CalculateMD5(filePath);
if (currentChecksum != lastChecksum)
throw new FileValidationFailedException(filePath, lastChecksum, currentChecksum);
else return new FileStream(filePath, FileMode.Append, FileAccess.Write);
}
else return new FileStream(filePath, FileMode.Append, FileAccess.Write);
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels

