Example #1
0
 public DownloadStartedEventArgs(IDownload download, DownloadCheckResult checkResult,
                                 long alreadyDownloadedSize = 0)
 {
     this.Download              = download;
     this.CheckResult           = checkResult;
     this.AlreadyDownloadedSize = alreadyDownloadedSize;
 }
Example #2
0
        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);
        }
Example #3
0
        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;
 }
 public DownloadStartedEventArgs(IDownload download, DownloadCheckResult checkResult)
 {
     this.Download    = download;
     this.CheckResult = checkResult;
 }