public SDCheckData CheckDownload(WebResponse response) { var result = new SDCheckData(); var acceptRanges = response.Headers["Accept-Ranges"]; result.SupportsResume = !string.IsNullOrEmpty(acceptRanges) && acceptRanges.ToLower().Contains("bytes"); result.Size = response.ContentLength; result.StatusCode = (int?)(response as HttpWebResponse)?.StatusCode; result.Success = true; return(result); }
private void DetermineFileSizeAndStartDownloads(SDCheckData 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 DownloadCheckNotSuccessfulException(string message, Exception ex, SDCheckData downloadCheckResult) : base(message, ex) { this.DownloadCheckResult = downloadCheckResult; }
public SDStartedEventArgs(ISD download, SDCheckData checkResult, long alreadyDownloadedSize = 0) { this.Download = download; this.CheckResult = checkResult; this.AlreadyDownloadedSize = alreadyDownloadedSize; }