public DownloadStartedEventArgs(IDownload download, DownloadCheckResult checkResult, long alreadyDownloadedSize = 0) { this.Download = download; this.CheckResult = checkResult; this.AlreadyDownloadedSize = alreadyDownloadedSize; }
public DownloadCheckResult CheckDownload(WebResponse response) { var result = new DownloadCheckResult(); var acceptRanges = response.Headers["Accept-Ranges"]; result.SupportsResume = !string.IsNullOrEmpty(acceptRanges) && acceptRanges.ToLower().Contains("bytes"); result.Size = (int)response.ContentLength; return(result); }
private void DetermineFileSizeAndStartDownloads(DownloadCheckResult downloadCheck) { lock (this.monitor) { this.ToDoRanges = this.DetermineToDoRanges(downloadCheck.Size, this.AlreadyDownloadedRanges); this.SplitToDoRangesForNumberOfParts(); for (int i = 0; i < this.numberOfParts; i++) { var todoRange = this.ToDoRanges[i]; StartDownload(todoRange); } } }
public void OnDownloadStarted(DownloadCheckResult checkResult) { this.OnDownloadStarted(new DownloadStartedEventArgs(this, checkResult)); }
public DownloadStartedEventArgs(IDownload download, DownloadCheckResult checkResult) { this.Download = download; this.CheckResult = checkResult; }
public DownloadCheckNotSuccessfulException(string message, Exception ex, DownloadCheckResult downloadCheckResult) : base(message, ex) { this.DownloadCheckResult = downloadCheckResult; }