Exemplo n.º 1
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);
                }
            }
        }
Exemplo n.º 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           = response.ContentLength;
            var webResponse = response as HttpWebResponse;

            if (webResponse != null)
            {
                result.StatusCode = (int?)(response as HttpWebResponse).StatusCode;
            }
            result.Success = true;
            return(result);
        }
Exemplo n.º 3
0
 public DownloadCheckNotSuccessfulException(string message, Exception ex, DownloadCheckResult downloadCheckResult) : base(message, ex)
 {
     this.DownloadCheckResult = downloadCheckResult;
 }