public async Task <bool> MoveToTrashAsync(IReadOnlyList <string> nodes, CancellationToken cancellationToken) { cancellationToken.ThrowIfCancellationRequested(); var volume = GetVolume(nodes); await PrepareAsync(nodes); var trashCanLocations = GetTrashCanLocations(volume); var result = false; foreach (var trashCanLocation in trashCanLocations) { cancellationToken.ThrowIfCancellationRequested(); var filesTrashCanLocation = GetFilesTrashCanLocation(trashCanLocation); // TODO: create if not exists? var destinationPathsDictionary = GetFilesTrashCanPathsMapping(nodes, filesTrashCanLocation); await _operationsService.MoveAsync(destinationPathsDictionary); await WriteMetaDataAsync(destinationPathsDictionary, trashCanLocation); result = true; break; } await CleanupAsync(); return(result); }
public async Task MoveFilesAsync(IReadOnlyList <string> files, string fullPath) { var targetDirectory = ExtractDirectory(fullPath); var filteredFiles = Filter(files, targetDirectory); if (filteredFiles.Any()) { await _operationsService.MoveAsync(filteredFiles, targetDirectory); } }
private async Task <bool> TryMoveToTrashAsync(IReadOnlyDictionary <string, string> files) { try { await _operationsService.MoveAsync(files); } catch { return(false); } // TODO: check results in future return(true); }
private void Move() => Execute(() => _operationsService.MoveAsync(GetSelectedNodes(), _filesOperationsMediator.OutputDirectory));
public Task MoveAsync(string filePath) => _operationsService.MoveAsync(CreateFilesList(filePath), _filesOperationsMediator.OutputDirectory);
private Task MoveAsync() => _operationsService.MoveAsync(Files, _filesOperationsMediator.OutputDirectory);
private Task MoveAsync() => _operationsService.MoveAsync(GetSelectedFiles(), _filesOperationsMediator.OutputDirectory);
public Task MoveFilesAsync(IReadOnlyList <string> files, string fullPath) => _operationsService.MoveAsync(files, ExtractDirectory(fullPath));