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 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 = response.ContentLength; var webResponse = response as HttpWebResponse; if (webResponse != null) { result.StatusCode = (int?)(response as HttpWebResponse).StatusCode; } result.Success = true; return(result); }
public DownloadCheckNotSuccessfulException(string message, Exception ex, DownloadCheckResult downloadCheckResult) : base(message, ex) { this.DownloadCheckResult = downloadCheckResult; }