private IEnumerable <SearchEngineMatch> processDirectory(string path, SearchEngineDirectoryConfig directoryConfig) { List <SearchEngineMatch> matches = new List <SearchEngineMatch>(); if (Directory.Exists(path)) { if (directoryConfig.SearchInSubDirectories) { foreach (string dir in Directory.GetDirectories(path)) { matches.AddRange(processDirectory(dir, directoryConfig)); } } foreach (string file in Directory.GetFiles(path, directoryConfig.FileNamePattern)) { if (directoryConfig.IgnoreFileNamePatterns.Where(x => file.IndexOf(x) > -1).Count() == 0) { matches.AddRange(processFile(file)); } } } return(matches); }
public IEnumerable <SearchEngineMatch> SearchInDirectory(string startPath, SearchEngineDirectoryConfig directoryConfig) { return(processDirectory(startPath, directoryConfig)); }