private MamlCommandHelpInfo GetFromCommandCacheByRemovingPrefix(string helpIdentifier, CommandInfo cmdInfo)
        {
            MamlCommandHelpInfo info  = null;
            MamlCommandHelpInfo info2 = this.GetFromCommandCache(helpIdentifier, ModuleCmdletBase.RemovePrefixFromCommandName(cmdInfo.Name, cmdInfo.Prefix), cmdInfo.HelpCategory) as MamlCommandHelpInfo;

            if (info2 != null)
            {
                info = info2.Copy();
                if (info.FullHelp.Properties["Name"] != null)
                {
                    info.FullHelp.Properties.Remove("Name");
                }
                info.FullHelp.Properties.Add(new PSNoteProperty("Name", cmdInfo.Name));
                if ((info.FullHelp.Properties["Details"] == null) || (info.FullHelp.Properties["Details"].Value == null))
                {
                    return(info);
                }
                PSObject obj2 = PSObject.AsPSObject(info.FullHelp.Properties["Details"].Value).Copy();
                if (obj2.Properties["Name"] != null)
                {
                    obj2.Properties.Remove("Name");
                }
                obj2.Properties.Add(new PSNoteProperty("Name", cmdInfo.Name));
                info.FullHelp.Properties["Details"].Value = obj2;
            }
            return(info);
        }
Example #2
0
        private bool IsCommandInResult(CommandInfo command)
        {
            bool flag2 = command.Module != null;

            foreach (CommandInfo info in this.accumulatedResults)
            {
                if ((((command.CommandType == info.CommandType) && ((string.Compare(command.Name, info.Name, StringComparison.CurrentCultureIgnoreCase) == 0) || (string.Compare(ModuleCmdletBase.RemovePrefixFromCommandName(info.Name, info.Prefix), command.Name, StringComparison.CurrentCultureIgnoreCase) == 0))) && ((info.Module != null) && flag2)) && (((info.IsImported && command.IsImported) && info.Module.Equals(command.Module)) || ((!info.IsImported || !command.IsImported) && info.Module.Path.Equals(command.Module.Path, StringComparison.OrdinalIgnoreCase))))
                {
                    return(true);
                }
            }
            return(false);
        }