private void Execute_Click(object sender, RoutedEventArgs e) { var inputFile = InputFileSelector.Content.ToString(); var outputFolder = OutputDirectorySelector.Content.ToString(); var fileType = System.IO.Path.GetExtension(inputFile); switch (fileType) { case ".wd": _wdExtractor.Extract(inputFile, outputFolder); break; case ".tex": _texConverter.Convert(inputFile, outputFolder); break; case ".msh": _mshConverters["dae"].Convert(inputFile, outputFolder); break; } }
private void HandleCommand(string input, string output) { var path = Path.GetDirectoryName(input); if (string.IsNullOrEmpty(path)) { path = Environment.CurrentDirectory; } var filePattern = Path.GetFileName(input); var files = Directory.GetFiles(path, filePattern, SearchOption.TopDirectoryOnly); files.AsParallel().ForAll(filePath => { try { _extractor.Extract(filePath, output); _logger.LogInformation("Processed file {FilePath}", filePath); } catch (Exception e) { _logger.LogError(e, "Error occured while processing file {FilePath}", filePath); } }); }