예제 #1
0
 internal override IEnumerable <HelpInfo> SearchHelp(
     HelpRequest helpRequest,
     bool searchOnlyContent)
 {
     using (AliasHelpProvider.tracer.TraceMethod())
     {
         if (!searchOnlyContent)
         {
             string target  = helpRequest.Target;
             string pattern = target;
             if (!WildcardPattern.ContainsWildcardCharacters(target))
             {
                 // ISSUE: reference to a compiler-generated field
                 this.\u003Cpattern\u003E5__a += "*";
             }
             WildcardPattern matcher = new WildcardPattern(pattern, WildcardOptions.IgnoreCase);
             IDictionary <string, AliasInfo> aliasTable = this._sessionState.Internal.GetAliasTable();
             foreach (string key in (IEnumerable <string>)aliasTable.Keys)
             {
                 if (matcher.IsMatch(key))
                 {
                     HelpRequest exactMatchHelpRequest = helpRequest.Clone();
                     exactMatchHelpRequest.Target = key;
                     foreach (HelpInfo helpInfo in this.ExactMatchHelp(exactMatchHelpRequest))
                     {
                         if (AliasHelpProvider.Match(helpInfo, helpRequest))
                         {
                             yield return(helpInfo);
                         }
                     }
                 }
             }
         }
     }
 }
예제 #2
0
        /// <summary>
        /// Initialize help providers.
        /// </summary>
        /// <remarks>
        /// Currently we hardcode the sequence of help provider initialization.
        /// In the longer run, we probably will load help providers based on some provider catalog. That
        /// will allow new providers to be defined by customer.
        /// </remarks>
        private void InitializeHelpProviders()
        {
            HelpProvider helpProvider = null;

            helpProvider = new AliasHelpProvider(this);
            _helpProviders.Add(helpProvider);

            helpProvider = new ScriptCommandHelpProvider(this);
            _helpProviders.Add(helpProvider);

            helpProvider = new CommandHelpProvider(this);
            _helpProviders.Add(helpProvider);

            helpProvider = new ProviderHelpProvider(this);
            _helpProviders.Add(helpProvider);

            helpProvider = new PSClassHelpProvider(this);
            _helpProviders.Add(helpProvider);

            /* TH Bug#3141590 - Disable DscResourceHelp for ClientRTM due to perf issue.
             #if !CORECLR // TODO:CORECLR Add this back in once we support Get-DscResource
             * helpProvider = new DscResourceHelpProvider(this);
             * _helpProviders.Add(helpProvider);
             #endif
             */
            helpProvider = new HelpFileHelpProvider(this);
            _helpProviders.Add(helpProvider);

            helpProvider = new DefaultHelpProvider(this);
            _helpProviders.Add(helpProvider);
        }
예제 #3
0
 private static bool Match(string target, string[] patterns)
 {
     if (patterns == null || patterns.Length == 0)
     {
         return(true);
     }
     foreach (string pattern in patterns)
     {
         if (AliasHelpProvider.Match(target, pattern))
         {
             return(true);
         }
     }
     return(false);
 }
예제 #4
0
        private void InitializeHelpProviders()
        {
            HelpProvider provider = null;

            provider = new AliasHelpProvider(this);
            this._helpProviders.Add(provider);
            provider = new ScriptCommandHelpProvider(this);
            this._helpProviders.Add(provider);
            provider = new CommandHelpProvider(this);
            this._helpProviders.Add(provider);
            provider = new ProviderHelpProvider(this);
            this._helpProviders.Add(provider);
            provider = new HelpFileHelpProvider(this);
            this._helpProviders.Add(provider);
            provider = new FaqHelpProvider(this);
            this._helpProviders.Add(provider);
            provider = new GlossaryHelpProvider(this);
            this._helpProviders.Add(provider);
            provider = new GeneralHelpProvider(this);
            this._helpProviders.Add(provider);
            provider = new DefaultHelpProvider(this);
            this._helpProviders.Add(provider);
        }
예제 #5
0
파일: HelpSystem.cs 프로젝트: nickchal/pash
 private void InitializeHelpProviders()
 {
     HelpProvider provider = null;
     provider = new AliasHelpProvider(this);
     this._helpProviders.Add(provider);
     provider = new ScriptCommandHelpProvider(this);
     this._helpProviders.Add(provider);
     provider = new CommandHelpProvider(this);
     this._helpProviders.Add(provider);
     provider = new ProviderHelpProvider(this);
     this._helpProviders.Add(provider);
     provider = new HelpFileHelpProvider(this);
     this._helpProviders.Add(provider);
     provider = new FaqHelpProvider(this);
     this._helpProviders.Add(provider);
     provider = new GlossaryHelpProvider(this);
     this._helpProviders.Add(provider);
     provider = new GeneralHelpProvider(this);
     this._helpProviders.Add(provider);
     provider = new DefaultHelpProvider(this);
     this._helpProviders.Add(provider);
 }
예제 #6
0
 private static bool Match(HelpInfo helpInfo, HelpRequest helpRequest) => helpRequest == null || (helpRequest.HelpCategory & helpInfo.HelpCategory) != HelpCategory.None && AliasHelpProvider.Match(helpInfo.Component, helpRequest.Component) && (AliasHelpProvider.Match(helpInfo.Role, helpRequest.Role) && AliasHelpProvider.Match(helpInfo.Functionality, helpRequest.Functionality));
예제 #7
0
        /// <summary>
        /// Initialize help providers. 
        /// </summary>
        /// <remarks>
        /// Currently we hardcode the sequence of help provider initialization.
        /// In the longer run, we probably will load help providers based on some provider catalog. That
        /// will allow new providers to be defined by customer.
        /// </remarks>
        private void InitializeHelpProviders()
        {
            HelpProvider helpProvider = null;

            helpProvider = new AliasHelpProvider(this);
            _helpProviders.Add(helpProvider);

            helpProvider = new ScriptCommandHelpProvider(this);
            _helpProviders.Add(helpProvider);

            helpProvider = new CommandHelpProvider(this);
            _helpProviders.Add(helpProvider);

            helpProvider = new ProviderHelpProvider(this);
            _helpProviders.Add(helpProvider);

            helpProvider = new PSClassHelpProvider(this);
            _helpProviders.Add(helpProvider);

            /* TH Bug#3141590 - Disable DscResourceHelp for ClientRTM due to perf issue.
#if !CORECLR // TODO:CORECLR Add this back in once we support Get-DscResource
            helpProvider = new DscResourceHelpProvider(this);
            _helpProviders.Add(helpProvider);
#endif
            */
            helpProvider = new HelpFileHelpProvider(this);
            _helpProviders.Add(helpProvider);

            helpProvider = new FaqHelpProvider(this);
            _helpProviders.Add(helpProvider);

            helpProvider = new GlossaryHelpProvider(this);
            _helpProviders.Add(helpProvider);

            helpProvider = new GeneralHelpProvider(this);
            _helpProviders.Add(helpProvider);

            helpProvider = new DefaultHelpProvider(this);
            _helpProviders.Add(helpProvider);
        }