コード例 #1
0
        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);
        }
コード例 #2
0
        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);
                }
            }
        }
コード例 #3
0
 public DownloadCheckNotSuccessfulException(string message, Exception ex, SDCheckData downloadCheckResult) : base(message, ex)
 {
     this.DownloadCheckResult = downloadCheckResult;
 }
コード例 #4
0
 public SDStartedEventArgs(ISD download, SDCheckData checkResult, long alreadyDownloadedSize = 0)
 {
     this.Download              = download;
     this.CheckResult           = checkResult;
     this.AlreadyDownloadedSize = alreadyDownloadedSize;
 }