示例#1
0
        public void DownloadFile(FileCompact file, string filePath, int maxChunkSize, int maxThreadCount,
                                 CancellationToken token = new CancellationToken())
        {
            var command = new DownloadFileCommand(this, file, filePath, Settings, maxThreadCount, maxChunkSize, token);

            command.FileDownloadProgressChanged += command_FileDownloadProgressChanged;
            command.Execute();
        }
示例#2
0
        public void DownloadFile(FileCompact file, Stream stream, CancellationToken token = new CancellationToken())
        {
            var command = new DownloadFileCommand(this, file, stream, Settings, token, WebProxy);

            command.FileDownloadProgressChanged += command_FileDownloadProgressChanged;

            command.Execute();
        }
        public DownloadFileCommand(BaseSpaceClient client, FileCompact file, string targetFileName,
                                   IClientSettings settings, CancellationToken token = new CancellationToken(), bool enableLogging = true, int threadCount = DEFAULT_THREADS)
        {
            DateTime expiration;
            string   url = GetFileContentUrl(client, file.Id, out expiration);
            ILargeFileDownloadParameters parameters = new LargeFileDownloadParameters(new Uri(url), targetFileName, maxThreads: threadCount, maxChunkSize: (int?)settings.FileDownloadMultipartSizeThreshold, id: file.Id);

            _parameters    = parameters;
            _token         = token;
            _enableLogging = enableLogging;
        }
        public DownloadFileCommand(BaseSpaceClient client, FileCompact file, string targetFileName, IClientSettings settings, int threadCount, int maxChunkSize, CancellationToken token = new CancellationToken(), bool enableLogging = true)
        {
            DateTime expiration;
            string   url = GetFileContentUrl(client, file.Id, out expiration);

            _fileName = string.Format("[{0}],{1}", file.Id, file.Name);
            ILargeFileDownloadParameters parameters = new LargeFileDownloadParameters(new Uri(url), targetFileName, maxThreads: threadCount, maxChunkSize: maxChunkSize, id: file.Id);

            _parameters    = parameters;
            _token         = token;
            _enableLogging = enableLogging;
        }
 public DownloadFileCommand(BaseSpaceClient client, FileCompact file, Stream stream, IClientSettings settings, CancellationToken token = new CancellationToken(), IWebProxy proxy = null, bool enableLogging = true) : this(client, file.Id, stream, settings, token, proxy, enableLogging)
 {
 }