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); }
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); }
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(); }
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); }