コード例 #1
0
 public DownloadFileCommand(BaseSpaceClient client, FileCompact file, Stream stream, IClientSettings settings, CancellationToken token = new CancellationToken())
 {
     _client = client;
     _settings = settings;
     _stream = stream;
     _file = file;
     Token = token;
     ChunkSize = Convert.ToInt32(_settings.FileMultipartSizeThreshold);
     MaxRetries = Convert.ToInt32(_settings.RetryAttempts);
 }
コード例 #2
0
 public DownloadFileCommand(BaseSpaceClient client, string fileId, Stream stream, IClientSettings settings, CancellationToken token = new CancellationToken())
 {
     _client = client;
     _settings = settings;
     _stream = stream;
     _file = _client.GetFilesInformation(new GetFileInformationRequest(fileId), null).Response;
     Token = token;
     ChunkSize = Convert.ToInt32(_settings.FileMultipartSizeThreshold);
     MaxRetries = Convert.ToInt32(_settings.RetryAttempts);
 }
コード例 #3
0
        public void DownloadFile(FileCompact file, string filePath, CancellationToken token = new CancellationToken())
        {
            var command = new DownloadFileCommand(this, file, filePath, Settings, token);
            command.FileDownloadProgressChanged += command_FileDownloadProgressChanged;

            command.Execute();
        }
コード例 #4
0
        public Task DownloadFileTaskAsync(FileCompact file, Stream stream, CancellationToken token = new CancellationToken())
        {
            var command = new DownloadFileCommand(this, file, stream, ClientSettings, token);
            command.FileDownloadProgressChanged += command_FileDownloadProgressChanged;

            return Task.Factory.StartNew(command.Execute, token);
        }