private static void ExecuteCommand(FileInfo indexFile, string pathSpec, bool parallel, bool flat, DirectoryInfo output) { var globOptions = new GlobOptions(); globOptions.Evaluation.CaseInsensitive = true; var glob = Glob.Parse(pathSpec, globOptions); string outputDirectory = output?.FullName ?? Directory.GetCurrentDirectory(); var index = new IndexFile(indexFile.FullName); var files = index.GetAllFilePaths().Where(path => glob.IsMatch(path)); Console.WriteLine($"Extracting {files.Count()} matching files"); if (parallel) { Parallel.ForEach(files, (file) => ExtractFile(index, file, outputDirectory, flat)); } else { foreach (var file in files) { ExtractFile(index, file, outputDirectory, flat); } } }
private static void ExecuteCommand(FileInfo indexFile) { var index = new IndexFile(indexFile.FullName); foreach (var path in index.GetAllFilePaths()) { Console.WriteLine(path); } }