public void SearchInFiles()
        {
            DirectoryTreeWalker directoryTreeWalker = new DirectoryTreeWalker();
            directoryTreeWalker.SearchSubDirectories = true;
            directoryTreeWalker.WalkTheTree(SearchRootPath);

            //ok now the tree has been walked. Get the list of all the text files and then determine the presence of the strings
            string fileContent = string.Empty;

            foreach (string file in directoryTreeWalker.Files)
            {
                fileContent = ReadTextFile(file);

                KMPEngine kmpEngine = new KMPEngine(fileContent, SearchPattern);

                List<int> occurences = kmpEngine.Find(false, true);

                if (occurences.Count == 0)
                    continue;

                if (occurences[0] != -1)
                {
                    _fileNamesWithContentPresent.Add(file);
                }
            }
        }
        public void SearchInFiles(bool searchSubDirectories, FileMetaAttributeFilter fileFilter)
        {
            DirectoryTreeWalker directoryTreeWalker = new DirectoryTreeWalker();
            directoryTreeWalker.SearchSubDirectories = searchSubDirectories;
            directoryTreeWalker.WalkTheTree(SearchRootPath);

            //ok now the tree has been walked. Get the list of all the text files and then determine the presence of the strings
            string fileContent = string.Empty;

            foreach (string file in directoryTreeWalker.Files)
            {
                if (!Utilities.IsTextFile(file))
                    continue;

                FileMetaAttributes fileAttributes = Utilities.GetFileMetaAttributes(file);

                if (null != fileFilter && !Utilities.EvaluateMetaAttributeFilters(fileAttributes, fileFilter))
                    continue;

                fileContent = Utilities.ReadTextFromFiles(file);

                KMPEngine kmpEngine = new KMPEngine(fileContent, SearchPattern);

                List<int> occurences = kmpEngine.Find(true, true);

                if (occurences.Count == 0)
                    continue;

                if (occurences[0] != -1)
                {

                    _fileNamesWithContentPresent.Add(file);

                    _fileNameToOccurencePositionsMap.Add(file, occurences);
                }
            }
        }
 public void TestKMPAlgorithmLogic()
 {
     KMPEngine engine = new KMPEngine("ssl rocks!!", "ssl");
     List<int> occurences = engine.Find(true, true);
 }
        internal void SearchInFiles(List<string> filesToSearch)
        {
            if (filesToSearch.Count == 0)
            {
                throw new ArgumentException("The list of files specified for search cannot be empty.");
            }

            foreach (string file in filesToSearch)
            {
                if (!Utilities.IsTextFile(file))
                    continue;

                string fileContent = Utilities.ReadTextFromFiles(file);

                KMPEngine kmpEngine = new KMPEngine(fileContent, SearchPattern);

                List<int> occurences = kmpEngine.Find(true, true);

                if (occurences.Count == 0)
                    continue;

                if (occurences[0] != -1)
                {

                    _fileNamesWithContentPresent.Add(file);

                    _fileNameToOccurencePositionsMap.Add(file, occurences);
                }
            }
        }