/// <summary>
        /// Checks if user has requested help (for example passing "-?" parameter for a cmdlet)
        /// and if yes, then returns the help target to display.
        /// </summary>
        /// <param name="helpTarget">Help target to request.</param>
        /// <param name="helpCategory">Help category to request.</param>
        /// <returns><see langword="true"/> if user requested help; <see langword="false"/> otherwise.</returns>
        internal override bool IsHelpRequested(out string helpTarget, out HelpCategory helpCategory)
        {
            if (arguments != null && CommandInfo != null && !string.IsNullOrEmpty(CommandInfo.Name) && _scriptBlock != null)
            {
                foreach (CommandParameterInternal parameter in this.arguments)
                {
                    Dbg.Assert(parameter != null, "CommandProcessor.arguments shouldn't have any null arguments");
                    if (parameter.IsDashQuestion())
                    {
                        Dictionary <Ast, Token[]> scriptBlockTokenCache = new Dictionary <Ast, Token[]>();
                        HelpInfo helpInfo = _scriptBlock.GetHelpInfo(context: Context, commandInfo: CommandInfo,
                                                                     dontSearchOnRemoteComputer: false, scriptBlockTokenCache: scriptBlockTokenCache, helpFile: out _, helpUriFromDotLink: out _);
                        if (helpInfo == null)
                        {
                            break;
                        }

                        helpTarget   = helpInfo.Name;
                        helpCategory = helpInfo.HelpCategory;
                        return(true);
                    }
                }
            }

            return(base.IsHelpRequested(out helpTarget, out helpCategory));
        }
        private HelpInfo GetHelpInfo(IScriptCommandInfo scriptCommandInfo, bool reportErrors, bool searchOnlyContent)
        {
            CommandInfo commandInfo          = (CommandInfo)scriptCommandInfo;
            HelpInfo    helpInfoFromWorkflow = null;
            ScriptBlock scriptBlock          = null;

            try
            {
                scriptBlock = scriptCommandInfo.ScriptBlock;
            }
            catch (RuntimeException)
            {
                return(null);
            }
            if (scriptBlock != null)
            {
                string helpFile           = null;
                string str2               = null;
                string helpUriFromDotLink = null;
                helpInfoFromWorkflow = scriptBlock.GetHelpInfo(this._context, commandInfo, searchOnlyContent, base.HelpSystem.ScriptBlockTokenCache, out helpFile, out helpUriFromDotLink);
                if (!string.IsNullOrEmpty(helpUriFromDotLink))
                {
                    try
                    {
                        new Uri(helpUriFromDotLink);
                        str2 = helpUriFromDotLink;
                    }
                    catch (UriFormatException)
                    {
                    }
                }
                if (helpInfoFromWorkflow != null)
                {
                    Uri uriForOnlineHelp = helpInfoFromWorkflow.GetUriForOnlineHelp();
                    if (uriForOnlineHelp != null)
                    {
                        str2 = uriForOnlineHelp.ToString();
                    }
                }
                if (helpFile != null)
                {
                    if (!this._helpFiles.Contains(helpFile))
                    {
                        this.LoadHelpFile(helpFile, helpFile, commandInfo.Name, reportErrors);
                    }
                    helpInfoFromWorkflow = this.GetFromCommandCache(helpFile, commandInfo) ?? helpInfoFromWorkflow;
                }
                if (helpInfoFromWorkflow == null)
                {
                    if ((commandInfo.CommandType == CommandTypes.ExternalScript) || (commandInfo.CommandType == CommandTypes.Script))
                    {
                        helpInfoFromWorkflow = SyntaxHelpInfo.GetHelpInfo(commandInfo.Name, commandInfo.Syntax, commandInfo.HelpCategory);
                    }
                    else
                    {
                        if (commandInfo.CommandType == CommandTypes.Workflow)
                        {
                            helpInfoFromWorkflow = this.GetHelpInfoFromWorkflow(commandInfo, reportErrors);
                        }
                        if (helpInfoFromWorkflow == null)
                        {
                            PSObject pSObjectFromCmdletInfo = DefaultCommandHelpObjectBuilder.GetPSObjectFromCmdletInfo(commandInfo);
                            pSObjectFromCmdletInfo.TypeNames.Clear();
                            pSObjectFromCmdletInfo.TypeNames.Add(DefaultCommandHelpObjectBuilder.TypeNameForDefaultHelp);
                            pSObjectFromCmdletInfo.TypeNames.Add("CmdletHelpInfo");
                            pSObjectFromCmdletInfo.TypeNames.Add("HelpInfo");
                            helpInfoFromWorkflow = new MamlCommandHelpInfo(pSObjectFromCmdletInfo, commandInfo.HelpCategory);
                        }
                    }
                }
                if (helpInfoFromWorkflow.GetUriForOnlineHelp() == null)
                {
                    if (!string.IsNullOrEmpty(commandInfo.CommandMetadata.HelpUri))
                    {
                        DefaultCommandHelpObjectBuilder.AddRelatedLinksProperties(helpInfoFromWorkflow.FullHelp, commandInfo.CommandMetadata.HelpUri);
                    }
                    else if (!string.IsNullOrEmpty(str2))
                    {
                        DefaultCommandHelpObjectBuilder.AddRelatedLinksProperties(helpInfoFromWorkflow.FullHelp, str2);
                    }
                }
            }
            if ((helpInfoFromWorkflow != null) && (helpInfoFromWorkflow.FullHelp.Properties["ModuleName"] == null))
            {
                helpInfoFromWorkflow.FullHelp.Properties.Add(new PSNoteProperty("ModuleName", commandInfo.ModuleName));
            }
            return(helpInfoFromWorkflow);
        }