private List <T> Filter <T>( FilterConfig config, IEnumerable <T> items, Func <FilterConfig, T, bool> func ) { var result = new List <T>(); foreach (var item in items) { if (func(config, item)) { continue; } result.Add(item); } return(result); }
private bool AppliesFile(FilterConfig config, FileInfo file) { var result = config.Entries.Any(x => AppliesFile(x, file)); return(result); }
public List <DirectoryInfo> Filter(FilterConfig config, IEnumerable <DirectoryInfo> directories) => Filter(config, directories, AppliesDirectory);
public List <FileInfo> Filter(FilterConfig config, IEnumerable <FileInfo> files) => Filter(config, files, AppliesFile);
private bool AppliesDirectory(FilterConfig config, DirectoryInfo directory) => config.Entries.Any(x => AppliesDirectory(x, directory));