protected virtual RecursivePath[] EnumerateFiles(IServiceProvider provider, string selectPattern, string[] filterPatterns) { var foundItems = IOExtensions.SearchFiles(selectPattern, (pattern, file) => file.DetermineRecursivePath(pattern)) .Items .ToList(); var filteredFiles = new List <RecursivePath>(); var logger = provider.GetService <ILogger>(); foreach (var pattern in filterPatterns) { var paths = IOExtensions.Match(foundItems, pattern, path => path.Original).ToList(); if (paths.Any()) { logger.Info($"Files filtered by {pattern} pattern:"); foreach (var path in paths) { logger.Info($"- {path.Original}"); } } else { logger.Info($"There is no files to filter by {pattern} pattern"); } filteredFiles.AddRange(paths); } filteredFiles = filteredFiles.Distinct().ToList(); return(foundItems.Except(filteredFiles).ToArray()); }