示例#1
0
        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);
        }
示例#2
0
 public IEnumerable <SearchEngineMatch> SearchInDirectory(string startPath, SearchEngineDirectoryConfig directoryConfig)
 {
     return(processDirectory(startPath, directoryConfig));
 }