Ejemplo n.º 1
0
        public MultiPartDownloadBuilder(
            int numberOfParts,
            IDownloadBuilder downloadBuilder,
            IWebRequestBuilder requestBuilder,
            IDownloadChecker downloadChecker,
            List<DownloadRange> alreadyDownloadedRanges)
        {
            if (numberOfParts <= 0)
                throw new ArgumentException("numberOfParts <= 0");

            if (downloadBuilder == null)
                throw new ArgumentNullException("downloadBuilder");

            if (requestBuilder == null)
                throw new ArgumentNullException("requestBuilder");

            if (downloadChecker == null)
                throw new ArgumentNullException("downloadChecker");

            this.numberOfParts = numberOfParts;
            this.downloadBuilder = downloadBuilder;
            this.requestBuilder = requestBuilder;
            this.downloadChecker = downloadChecker;
            this.alreadyDownloadedRanges = alreadyDownloadedRanges ?? new List<DownloadRange>();
        }
Ejemplo n.º 2
0
        public MultiPartDownload(
            Uri url,
            int bufferSize,
            int numberOfParts,
            IDownloadBuilder downloadBuilder,
            IWebRequestBuilder requestBuilder,
            IDownloadChecker downloadChecker,
            List <DownloadRange> alreadyDownloadedRanges)
            : base(url, bufferSize, null, null, requestBuilder, downloadChecker)
        {
            if (numberOfParts <= 0)
            {
                throw new ArgumentException("numberOfParts <= 0");
            }

            if (downloadBuilder == null)
            {
                throw new ArgumentNullException("downloadBuilder");
            }

            this.numberOfParts           = numberOfParts;
            this.downloadBuilder         = downloadBuilder;
            this.AlreadyDownloadedRanges = alreadyDownloadedRanges ?? new List <DownloadRange>();

            if (System.Net.ServicePointManager.DefaultConnectionLimit < numberOfParts)
            {
                System.Net.ServicePointManager.DefaultConnectionLimit = numberOfParts;
            }
        }
Ejemplo n.º 3
0
        public MultiPartDownloadBuilder(
            int numberOfParts,
            IDownloadBuilder downloadBuilder,
            IWebRequestBuilder requestBuilder,
            IDownloadChecker downloadChecker,
            List <DownloadRange> alreadyDownloadedRanges)
        {
            if (numberOfParts <= 0)
            {
                throw new ArgumentException("numberOfParts <= 0");
            }

            if (downloadBuilder == null)
            {
                throw new ArgumentNullException("downloadBuilder");
            }

            if (requestBuilder == null)
            {
                throw new ArgumentNullException("requestBuilder");
            }

            if (downloadChecker == null)
            {
                throw new ArgumentNullException("downloadChecker");
            }

            this.numberOfParts           = numberOfParts;
            this.downloadBuilder         = downloadBuilder;
            this.requestBuilder          = requestBuilder;
            this.downloadChecker         = downloadChecker;
            this.alreadyDownloadedRanges = alreadyDownloadedRanges ?? new List <DownloadRange>();
        }
Ejemplo n.º 4
0
        public MultiPartDownload(
            Uri url,
            int bufferSize,
            int numberOfParts,
            IDownloadBuilder downloadBuilder,
            IWebRequestBuilder requestBuilder,
            IDownloadChecker downloadChecker,
            List<DownloadRange> alreadyDownloadedRanges)
            : base(url, bufferSize, null, null, requestBuilder, downloadChecker)
        {
            if (numberOfParts <= 0)
                throw new ArgumentException("numberOfParts <= 0");

            if (downloadBuilder == null)
                throw new ArgumentNullException("downloadBuilder");

            this.numberOfParts = numberOfParts;
            this.downloadBuilder = downloadBuilder;
            this.AlreadyDownloadedRanges = alreadyDownloadedRanges ?? new List<DownloadRange>();

            if (System.Net.ServicePointManager.DefaultConnectionLimit < numberOfParts)
            {
                System.Net.ServicePointManager.DefaultConnectionLimit = numberOfParts;
            }
        }
Ejemplo n.º 5
0
        public ResumingDownloadBuilder(int timeForHeartbeat, int timeToRetry, int? maxRetries, IDownloadBuilder downloadBuilder)
        {
            if (timeForHeartbeat <= 0)
                throw new ArgumentException("timeForHeartbeat <= 0");

            if (timeToRetry <= 0)
                throw new ArgumentException("timeToRetry <= 0");

            if (downloadBuilder == null)
                throw new ArgumentNullException("downloadBuilder");

            this.timeForHeartbeat = timeForHeartbeat;
            this.timeToRetry = timeToRetry;
            this.maxRetries = maxRetries;
            this.downloadBuilder = downloadBuilder;
        }
Ejemplo n.º 6
0
        public ResumingDownload(Uri url, int bufferSize, int? offset, int? maxReadBytes, int timeForHeartbeat, int timeToRetry, int? maxRetries, IDownloadBuilder downloadBuilder)
            : base(url, bufferSize, offset, maxReadBytes, null, null)
        {
            if (timeForHeartbeat <= 0)
                throw new ArgumentException("timeForHeartbeat <= 0");

            if (timeToRetry <= 0)
                throw new ArgumentException("timeToRetry <= 0");

            if (downloadBuilder == null)
                throw new ArgumentException("downloadBuilder");

            this.timeForHeartbeat = timeForHeartbeat;
            this.timeToRetry = timeToRetry;
            this.maxRetries = maxRetries;
            this.downloadBuilder = downloadBuilder;
        }
        public ResumingDownloadBuilder(int timeForHeartbeat, int timeToRetry, int?maxRetries, IDownloadBuilder downloadBuilder)
        {
            if (timeForHeartbeat <= 0)
            {
                throw new ArgumentException("timeForHeartbeat <= 0");
            }

            if (timeToRetry <= 0)
            {
                throw new ArgumentException("timeToRetry <= 0");
            }

            if (downloadBuilder == null)
            {
                throw new ArgumentNullException("downloadBuilder");
            }

            this.timeForHeartbeat = timeForHeartbeat;
            this.timeToRetry      = timeToRetry;
            this.maxRetries       = maxRetries;
            this.downloadBuilder  = downloadBuilder;
        }
Ejemplo n.º 8
0
        public ResumingDownload(Uri url, int bufferSize, long?offset, long?maxReadBytes, int timeForHeartbeat, int timeToRetry, int?maxRetries, IDownloadBuilder downloadBuilder)
            : base(url, bufferSize, offset, maxReadBytes, null, null)
        {
            if (timeForHeartbeat <= 0)
            {
                throw new ArgumentException("timeForHeartbeat <= 0");
            }

            if (timeToRetry <= 0)
            {
                throw new ArgumentException("timeToRetry <= 0");
            }

            if (downloadBuilder == null)
            {
                throw new ArgumentException("downloadBuilder");
            }

            this.timeForHeartbeat = timeForHeartbeat;
            this.timeToRetry      = timeToRetry;
            this.maxRetries       = maxRetries;
            this.downloadBuilder  = downloadBuilder;
        }