public async Task ExtractAsync(ExtractCommandType commandType, string fullPath) { if (!CheckIfNodeIsArchive(fullPath)) { return; } switch (commandType) { case ExtractCommandType.CurrentDirectory: await _archiveService.ExtractAsync(fullPath); break; case ExtractCommandType.NewDirectory: await _archiveService.ExtractToNewDirectoryAsync(fullPath); break; case ExtractCommandType.SelectDirectory: var directory = await _systemDialogService.GetDirectoryAsync(); if (!string.IsNullOrWhiteSpace(directory)) { await _archiveService.ExtractAsync(fullPath, directory); } break; default: throw new ArgumentOutOfRangeException(nameof(commandType), commandType, null); } }
private async Task ExtractAsync() { var selectedArchives = _nodesSelectionService .SelectedNodes .Where(_archiveService.CheckIfNodeIsArchive) .ToArray(); if (!selectedArchives.Any()) { return; } var directory = await _systemDialogService.GetDirectoryAsync(); if (string.IsNullOrWhiteSpace(directory)) { return; } foreach (var archive in selectedArchives) { await _archiveService.ExtractAsync(archive, directory); } }