Esempio n. 1
0
        /// <summary>
        /// Simultaneously search for entries whose filepath contain a search phrase. Use the RAFSearchType to specify how to search
        /// </summary>
        /// <param name="searchPhrases">Array of phrases to look for</param>
        /// <param name="searchType">SearchType.All returns any entries whose filepath contains the search string. SearchType.End returns any entries whose filepath ends with the search string.</param>
        /// <returns>A struct with the found RAFFileListEntry and the search phrase that triggered it</returns>
        public List <RAFSearchResult> SearchFileEntries(String[] searchPhrases, RAFSearchType searchType)
        {
            List <RAFSearchResult> results = new List <RAFSearchResult>();

            foreach (KeyValuePair <String, RAFFileListEntry> entryKVP in this.fileDictFull)
            {
                string lowerFilename = entryKVP.Value.FileName.ToLower();
                foreach (String phrase in searchPhrases)
                {
                    String lowerPhrase = phrase.ToLower();
                    if (searchType == RAFSearchType.All && lowerFilename.Contains(lowerPhrase))
                    {
                        RAFSearchResult result;
                        result.searchPhrase = phrase;
                        result.value        = entryKVP.Value;
                        results.Add(result);
                        break;
                    }
                    else if (searchType == RAFSearchType.End && lowerFilename.EndsWith(lowerPhrase))
                    {
                        RAFSearchResult result;
                        result.searchPhrase = phrase;
                        result.value        = entryKVP.Value;
                        results.Add(result);
                        break;
                    }
                }
            }
            return(results);
        }
Esempio n. 2
0
        /// <summary>
        ///     Simultaneously search for entries whose filepath contain a search phrase. Use the RAFSearchType to specify how to
        ///     search
        /// </summary>
        /// <param name="searchPhrases">Array of phrases to look for</param>
        /// <param name="searchType">
        ///     SearchType.All returns any entries whose filepath contains the search string. SearchType.End
        ///     returns any entries whose filepath ends with the search string.
        /// </param>
        /// <returns>A struct with the found RAFFileListEntry and the search phrase that triggered it</returns>
        public List <RAFSearchResult> SearchFileEntries(String[] searchPhrases,
                                                        RAFSearchType searchType = RAFSearchType.All)
        {
            var results = new List <RAFSearchResult>();

            foreach (var entryKVP in m_fileDictFull)
            {
                var lowerFilename = entryKVP.Value.FileName.ToLower();
                foreach (var phrase in searchPhrases)
                {
                    var lowerPhrase = phrase.ToLower();
                    if (searchType == RAFSearchType.All && lowerFilename.Contains(lowerPhrase))
                    {
                        RAFSearchResult result;
                        result.SearchPhrase = phrase;
                        result.Value        = entryKVP.Value;
                        results.Add(result);
                        break;
                    }

                    if (searchType == RAFSearchType.End && lowerFilename.EndsWith(lowerPhrase))
                    {
                        RAFSearchResult result;
                        result.SearchPhrase = phrase;
                        result.Value        = entryKVP.Value;
                        results.Add(result);
                        break;
                    }
                }
            }
            return(results);
        }
Esempio n. 3
0
        /// <summary>
        /// Returns any entries whose filepath contains the search string. Use the RAFSearchType to specify how to search
        /// </summary>
        /// <param name="searchPhrase">The phrase to look for</param>
        /// <param name="searchType">SearchType.All returns any entries whose filepath contains the search string. SearchType.End returns any entries whose filepath ends with the search string.</param>
        /// <returns></returns>
        public List <RAFFileListEntry> SearchFileEntries(String searchPhrase, RAFSearchType searchType)
        {
            string lowerPhrase = searchPhrase.ToLower();
            List <RAFFileListEntry> results = new List <RAFFileListEntry>();

            foreach (KeyValuePair <String, RAFFileListEntry> entryKVP in this.fileDictFull)
            {
                String lowerFilename = entryKVP.Value.FileName.ToLower();
                if (searchType == RAFSearchType.All && lowerFilename.Contains(lowerPhrase))
                {
                    results.Add(entryKVP.Value);
                }
                else if (searchType == RAFSearchType.End && lowerFilename.EndsWith(lowerPhrase))
                {
                    results.Add(entryKVP.Value);
                }
            }
            return(results);
        }
Esempio n. 4
0
        /// <summary>
        ///     Returns any entries whose filepath contains the search string. Use the RAFSearchType to specify how to search
        /// </summary>
        /// <param name="searchPhrase">The phrase to look for</param>
        /// <param name="searchType">
        ///     SearchType.All returns any entries whose filepath contains the search string. SearchType.End
        ///     returns any entries whose filepath ends with the search string.
        /// </param>
        /// <returns></returns>
        public List <RAFFileListEntry> SearchFileEntries(String searchPhrase,
                                                         RAFSearchType searchType = RAFSearchType.All)
        {
            var lowerPhrase = searchPhrase.ToLower();
            var results     = new List <RAFFileListEntry>();

            foreach (var entryKVP in m_fileDictFull)
            {
                var lowerFilename = entryKVP.Value.FileName.ToLower();
                if (searchType == RAFSearchType.All && lowerFilename.Contains(lowerPhrase))
                {
                    results.Add(entryKVP.Value);
                }
                else if (searchType == RAFSearchType.End && lowerFilename.EndsWith(lowerPhrase))
                {
                    results.Add(entryKVP.Value);
                }
            }
            return(results);
        }
Esempio n. 5
0
        /// <summary>
        /// Simultaneously search for entries whose filepath contain a search phrase. Use the RAFSearchType to specify how to search
        /// </summary>
        /// <param name="searchPhrases">Array of phrases to look for</param>
        /// <param name="searchType">SearchType.All returns any entries whose filepath contains the search string. SearchType.End returns any entries whose filepath ends with the search string.</param>
        /// <returns>A struct with the found RAFFileListEntry and the search phrase that triggered it</returns>
        public List<RAFSearchResult> SearchFileEntries(String[] searchPhrases, RAFSearchType searchType)
        {
            List<RAFSearchResult> results = new List<RAFSearchResult>();

            foreach (KeyValuePair<String, RAFFileListEntry> entryKVP in this.fileDictFull)
            {
                string lowerFilename = entryKVP.Value.FileName.ToLower();
                foreach(String phrase in searchPhrases)
                {
                    String lowerPhrase = phrase.ToLower();
                    if (searchType == RAFSearchType.All && lowerFilename.Contains(lowerPhrase))
                    {
                        RAFSearchResult result;
                        result.searchPhrase = phrase;
                        result.value = entryKVP.Value;
                        results.Add(result);
                        break;
                    }
                    else if (searchType == RAFSearchType.End && lowerFilename.EndsWith(lowerPhrase))
                    {
                        RAFSearchResult result;
                        result.searchPhrase = phrase;
                        result.value = entryKVP.Value;
                        results.Add(result);
                        break;
                    }
                }
            }
            return results;
        }
Esempio n. 6
0
        /// <summary>
        /// Returns any entries whose filepath contains the search string. Use the RAFSearchType to specify how to search
        /// </summary>
        /// <param name="searchPhrase">The phrase to look for</param>
        /// <param name="searchType">SearchType.All returns any entries whose filepath contains the search string. SearchType.End returns any entries whose filepath ends with the search string.</param>
        /// <returns></returns>
        public List<RAFFileListEntry> SearchFileEntries(String searchPhrase, RAFSearchType searchType)
        {
            string lowerPhrase = searchPhrase.ToLower();
            List<RAFFileListEntry> results = new List<RAFFileListEntry>();

            foreach (KeyValuePair<String, RAFFileListEntry> entryKVP in this.fileDictFull)
            {
                String lowerFilename = entryKVP.Value.FileName.ToLower();
                if (searchType == RAFSearchType.All && lowerFilename.Contains(lowerPhrase))
                {
                    results.Add(entryKVP.Value);
                }
                else if (searchType == RAFSearchType.End && lowerFilename.EndsWith(lowerPhrase))
                {
                    results.Add(entryKVP.Value);
                }
            }
            return results;
        }
Esempio n. 7
0
        /// <summary>
        ///     Simultaneously search for entries whose filepath contain a search phrase. Use the RAFSearchType to specify how to
        ///     search
        /// </summary>
        /// <param name="searchPhrases">Array of phrases to look for</param>
        /// <param name="searchType">
        ///     SearchType.All returns any entries whose filepath contains the search string. SearchType.End
        ///     returns any entries whose filepath ends with the search string.
        /// </param>
        /// <returns>A struct with the found RAFFileListEntry and the search phrase that triggered it</returns>
        public List<RAFSearchResult> SearchFileEntries(String[] searchPhrases,
            RAFSearchType searchType = RAFSearchType.All)
        {
            var results = new List<RAFSearchResult>();

            foreach (var entryKVP in m_fileDictFull)
            {
                foreach (var entry in entryKVP.Value)
                {
                    var lowerFilename = entry.FileName.ToLower();
                    foreach (var phrase in searchPhrases)
                    {
                        var lowerPhrase = phrase.ToLower();
                        if (searchType == RAFSearchType.All && lowerFilename.Contains(lowerPhrase))
                        {
                            RAFSearchResult result;
                            result.SearchPhrase = phrase;
                            result.Value = entry;
                            results.Add(result);
                            break;
                        }

                        if (searchType == RAFSearchType.End && lowerFilename.EndsWith(lowerPhrase))
                        {
                            RAFSearchResult result;
                            result.SearchPhrase = phrase;
                            result.Value = entry;
                            results.Add(result);
                            break;
                        }
                    }
                }
            }
            return results;
        }
Esempio n. 8
0
        /// <summary>
        ///     Returns any entries whose filepath contains the search string. Use the RAFSearchType to specify how to search
        /// </summary>
        /// <param name="searchPhrase">The phrase to look for</param>
        /// <param name="searchType">
        ///     SearchType.All returns any entries whose filepath contains the search string. SearchType.End
        ///     returns any entries whose filepath ends with the search string.
        /// </param>
        /// <returns></returns>
        public List<RAFFileListEntry> SearchFileEntries(String searchPhrase,
            RAFSearchType searchType = RAFSearchType.All)
        {
            var lowerPhrase = searchPhrase.ToLower();
            var results = new List<RAFFileListEntry>();

            foreach (var entryKVP in m_fileDictFull)
            {
                foreach (var entry in entryKVP.Value)
                {
                    var lowerFilename = entry.FileName.ToLower();
                    if (searchType == RAFSearchType.All && lowerFilename.Contains(lowerPhrase))
                    {
                        results.Add(entry);
                    }
                    else if (searchType == RAFSearchType.End && lowerFilename.EndsWith(lowerPhrase))
                    {
                        results.Add(entry);
                    }
                }
            }
            return results;
        }