internal override IEnumerable <HelpInfo> SearchHelp(HelpRequest helpRequest, bool searchOnlyContent)
        {
            string          pattern           = helpRequest.Target;
            string          iteratorVariable1 = pattern;
            int             iteratorVariable2 = 0;
            WildcardPattern iteratorVariable3 = null;

            if (!searchOnlyContent && !WildcardPattern.ContainsWildcardCharacters(pattern))
            {
                iteratorVariable1 = "*" + iteratorVariable1 + "*";
            }
            if (searchOnlyContent)
            {
                string target = helpRequest.Target;
                if (!WildcardPattern.ContainsWildcardCharacters(helpRequest.Target))
                {
                    target = "*" + target + "*";
                }
                iteratorVariable3 = new WildcardPattern(target, WildcardOptions.IgnoreCase | WildcardOptions.Compiled);
                iteratorVariable1 = "*";
            }
            iteratorVariable1 = iteratorVariable1 + ".help.txt";
            Collection <string> iteratorVariable4 = MUIFileSearcher.SearchFiles(iteratorVariable1, this.GetSearchPaths());

            if (iteratorVariable4 != null)
            {
                foreach (string iteratorVariable5 in iteratorVariable4)
                {
                    if (!this._helpFiles.ContainsKey(iteratorVariable5))
                    {
                        try
                        {
                            this.LoadHelpFile(iteratorVariable5);
                        }
                        catch (IOException exception)
                        {
                            this.ReportHelpFileError(exception, helpRequest.Target, iteratorVariable5);
                        }
                        catch (SecurityException exception2)
                        {
                            this.ReportHelpFileError(exception2, helpRequest.Target, iteratorVariable5);
                        }
                    }
                    HelpFileHelpInfo cache = this.GetCache(iteratorVariable5) as HelpFileHelpInfo;
                    if ((cache != null) && (!searchOnlyContent || cache.MatchPatternInContent(iteratorVariable3)))
                    {
                        iteratorVariable2++;
                        yield return(cache);

                        if ((iteratorVariable2 >= helpRequest.MaxResults) && (helpRequest.MaxResults > 0))
                        {
                            break;
                        }
                    }
                }
            }
        }
示例#2
0
        internal sealed override void LoadCache()
        {
            Collection <string> collection = MUIFileSearcher.SearchFiles("*.concept.xml", base.GetSearchPaths());

            if (collection != null)
            {
                foreach (string str in collection)
                {
                    if (!this._helpFiles.ContainsKey(str))
                    {
                        this.LoadHelpFile(str);
                        this._helpFiles[str] = 0;
                    }
                }
            }
        }
        internal override IEnumerable <HelpInfo> ExactMatchHelp(HelpRequest helpRequest)
        {
            int    countHelpInfosFound       = 0;
            string helpFileName              = helpRequest.Target + ".help.txt";
            Collection <string> filesMatched = MUIFileSearcher.SearchFiles(helpFileName, GetExtendedSearchPaths());

            Diagnostics.Assert(filesMatched != null, "Files collection should not be null.");
            var matchedFilesToRemove = FilterToLatestModuleVersion(filesMatched);

            foreach (string file in filesMatched)
            {
                if (matchedFilesToRemove.Contains(file))
                {
                    continue;
                }

                // Check whether the file is already loaded
                if (!_helpFiles.ContainsKey(file))
                {
                    try
                    {
                        LoadHelpFile(file);
                    }
                    catch (IOException ioException)
                    {
                        ReportHelpFileError(ioException, helpRequest.Target, file);
                    }
                    catch (System.Security.SecurityException securityException)
                    {
                        ReportHelpFileError(securityException, helpRequest.Target, file);
                    }
                }

                HelpInfo helpInfo = GetCache(file);

                if (helpInfo != null)
                {
                    countHelpInfosFound++;
                    yield return(helpInfo);

                    if ((countHelpInfosFound >= helpRequest.MaxResults) && (helpRequest.MaxResults > 0))
                    {
                        yield break;
                    }
                }
            }
        }
示例#4
0
        internal override sealed void LoadCache()
        {
            Collection <string> collection = MUIFileSearcher.SearchFiles("*.faq.xml", this.GetSearchPaths());

            if (collection == null)
            {
                return;
            }
            foreach (string helpFile in collection)
            {
                if (!this._helpFiles.ContainsKey((object)helpFile))
                {
                    this.LoadHelpFile(helpFile);
                    this._helpFiles[(object)helpFile] = (object)0;
                }
            }
        }
示例#5
0
        /// <summary>
        /// Load cache for faq help's
        /// </summary>
        internal sealed override void LoadCache()
        {
            Collection <String> files = MUIFileSearcher.SearchFiles("*.faq.xml", GetSearchPaths());

            if (files == null)
            {
                return;
            }

            foreach (string file in files)
            {
                if (!_helpFiles.ContainsKey(file))
                {
                    LoadHelpFile(file);
                    // Add this file into _helpFiles hashtable to prevent it to be loaded again.
                    _helpFiles[file] = 0;
                }
            }
        }
示例#6
0
        internal override IEnumerable <HelpInfo> ExactMatchHelp(
            HelpRequest helpRequest)
        {
            using (HelpFileHelpProvider.tracer.TraceMethod())
            {
                int    countHelpInfosFound       = 0;
                string helpFileName              = helpRequest.Target + ".help.txt";
                Collection <string> filesMatched = MUIFileSearcher.SearchFiles(helpFileName, this.GetSearchPaths());
                foreach (string str in filesMatched)
                {
                    if (!this._helpFiles.ContainsKey((object)str))
                    {
                        try
                        {
                            this.LoadHelpFile(str);
                        }
                        catch (IOException ex)
                        {
                            this.ReportHelpFileError((Exception)ex, helpRequest.Target, str);
                        }
                        catch (SecurityException ex)
                        {
                            this.ReportHelpFileError((Exception)ex, helpRequest.Target, str);
                        }
                    }
                    HelpInfo helpInfo = this.GetCache(str);
                    if (helpInfo != null)
                    {
                        ++countHelpInfosFound;
                        yield return(helpInfo);

                        if (countHelpInfosFound >= helpRequest.MaxResults && helpRequest.MaxResults > 0)
                        {
                            break;
                        }
                    }
                }
            }
        }
        internal override IEnumerable <HelpInfo> ExactMatchHelp(HelpRequest helpRequest)
        {
            int    iteratorVariable0 = 0;
            string pattern           = helpRequest.Target + ".help.txt";
            Collection <string> iteratorVariable2 = MUIFileSearcher.SearchFiles(pattern, this.GetSearchPaths());

            foreach (string iteratorVariable3 in iteratorVariable2)
            {
                if (!this._helpFiles.ContainsKey(iteratorVariable3))
                {
                    try
                    {
                        this.LoadHelpFile(iteratorVariable3);
                    }
                    catch (IOException exception)
                    {
                        this.ReportHelpFileError(exception, helpRequest.Target, iteratorVariable3);
                    }
                    catch (SecurityException exception2)
                    {
                        this.ReportHelpFileError(exception2, helpRequest.Target, iteratorVariable3);
                    }
                }
                HelpInfo cache = this.GetCache(iteratorVariable3);
                if (cache != null)
                {
                    iteratorVariable0++;
                    yield return(cache);

                    if ((iteratorVariable0 >= helpRequest.MaxResults) && (helpRequest.MaxResults > 0))
                    {
                        break;
                    }
                }
            }
        }
        internal override IEnumerable <HelpInfo> SearchHelp(HelpRequest helpRequest, bool searchOnlyContent)
        {
            string target  = helpRequest.Target;
            string pattern = target;
            int    countOfHelpInfoObjectsFound = 0;
            // this will be used only when searchOnlyContent == true
            WildcardPattern wildCardPattern = null;

            if ((!searchOnlyContent) && (!WildcardPattern.ContainsWildcardCharacters(target)))
            {
                // Search all the about conceptual topics. This pattern
                // makes about topics discoverable without actually
                // using the word "about_" as in "get-help while".
                pattern = "*" + pattern + "*";
            }

            if (searchOnlyContent)
            {
                string searchTarget = helpRequest.Target;
                if (!WildcardPattern.ContainsWildcardCharacters(helpRequest.Target))
                {
                    searchTarget = "*" + searchTarget + "*";
                }

                wildCardPattern = WildcardPattern.Get(searchTarget, WildcardOptions.Compiled | WildcardOptions.IgnoreCase);
                // search all about_* topics
                pattern = "*";
            }

            pattern += ".help.txt";

            Collection <String> files = MUIFileSearcher.SearchFiles(pattern, GetExtendedSearchPaths());

            var matchedFilesToRemove = FilterToLatestModuleVersion(files);

            if (files == null)
            {
                yield break;
            }

            foreach (string file in files)
            {
                if (matchedFilesToRemove.Contains(file))
                {
                    continue;
                }

                // Check whether the file is already loaded
                if (!_helpFiles.ContainsKey(file))
                {
                    try
                    {
                        LoadHelpFile(file);
                    }
                    catch (IOException ioException)
                    {
                        ReportHelpFileError(ioException, helpRequest.Target, file);
                    }
                    catch (System.Security.SecurityException securityException)
                    {
                        ReportHelpFileError(securityException, helpRequest.Target, file);
                    }
                }

                HelpFileHelpInfo helpInfo = GetCache(file) as HelpFileHelpInfo;

                if (helpInfo != null)
                {
                    if (searchOnlyContent)
                    {
                        if (!helpInfo.MatchPatternInContent(wildCardPattern))
                        {
                            continue;
                        }
                    }

                    countOfHelpInfoObjectsFound++;
                    yield return(helpInfo);

                    if (countOfHelpInfoObjectsFound >= helpRequest.MaxResults && helpRequest.MaxResults > 0)
                    {
                        yield break;
                    }
                }
            }
        }
示例#9
0
        internal override IEnumerable <HelpInfo> SearchHelp(
            HelpRequest helpRequest,
            bool searchOnlyContent)
        {
            using (HelpFileHelpProvider.tracer.TraceMethod())
            {
                string          target  = helpRequest.Target;
                string          pattern = target;
                int             countOfHelpInfoObjectsFound = 0;
                WildcardPattern wildCardPattern             = (WildcardPattern)null;
                if (!searchOnlyContent && !WildcardPattern.ContainsWildcardCharacters(target))
                {
                    pattern = "*" + pattern + "*";
                }
                if (searchOnlyContent)
                {
                    string pattern1 = helpRequest.Target;
                    if (!WildcardPattern.ContainsWildcardCharacters(helpRequest.Target))
                    {
                        pattern1 = "*" + pattern1 + "*";
                    }
                    wildCardPattern = new WildcardPattern(pattern1, WildcardOptions.Compiled | WildcardOptions.IgnoreCase);
                    pattern         = "*";
                }
                // ISSUE: reference to a compiler-generated field
                this.\u003Cpattern\u003E5__e += ".help.txt";
                Collection <string> files = MUIFileSearcher.SearchFiles(pattern, this.GetSearchPaths());
                if (files != null)
                {
                    foreach (string str in files)
                    {
                        if (!this._helpFiles.ContainsKey((object)str))
                        {
                            try
                            {
                                this.LoadHelpFile(str);
                            }
                            catch (IOException ex)
                            {
                                this.ReportHelpFileError((Exception)ex, helpRequest.Target, str);
                            }
                            catch (SecurityException ex)
                            {
                                this.ReportHelpFileError((Exception)ex, helpRequest.Target, str);
                            }
                        }
                        HelpFileHelpInfo helpInfo = this.GetCache(str) as HelpFileHelpInfo;
                        if (helpInfo != null && (!searchOnlyContent || helpInfo.MatchPatternInContent(wildCardPattern)))
                        {
                            ++countOfHelpInfoObjectsFound;
                            yield return((HelpInfo)helpInfo);

                            if (countOfHelpInfoObjectsFound >= helpRequest.MaxResults && helpRequest.MaxResults > 0)
                            {
                                break;
                            }
                        }
                    }
                }
            }
        }
示例#10
0
 internal static Collection <string> SearchFiles(string pattern) => MUIFileSearcher.SearchFiles(pattern, new Collection <string>());