Esempio n. 1
0
        public List <KeywordMatch> Search(SearchParams context, string file)
        {
            m_terminate.Reset();

            List <KeywordMatch> matches = null;

            switch (context.FileType)
            {
            case FileContentType.Text:
            {
                SearchText text = new SearchText(m_terminate);
                matches = text.Search(context, file);
            }
            break;

            case FileContentType.Binary:
            {
                SearchBinary bin = new SearchBinary(m_terminate);
                matches = bin.Search(context, file);
                break;
            }

            case FileContentType.Detect:
                matches = DetectSearch(context, file);
                break;
            }
            return(matches);
        }
Esempio n. 2
0
        public List <KeywordMatch> DetectSearch(SearchParams context, string file)
        {
            List <KeywordMatch> matches = new List <KeywordMatch>();
            var contentType             = DetectFileType(file);

            switch (contentType)
            {
            case FileContentType.Binary:
            {
                SearchBinary bin = new SearchBinary(m_terminate);
                matches = bin.Search(context, file);
            }
            break;

            case FileContentType.Text:
            default:
            {
                SearchText text = new SearchText(m_terminate);
                matches = text.Search(context, file);
            }
            break;
            }

            return((matches == null || matches.Count() == 0) ? null : matches);
        }