コード例 #1
0
        static void HtmlGenerateReturnTypes(BBCodeParser rules, StringBuilder SB, CmdletObject cmdlet)
        {
            SB.Append("<h2><strong>Outputs</strong></h2>" + _nl);
            List <String> returnTypes       = new List <String>(cmdlet.GeneralHelp.ReturnType.Split(';'));
            List <String> returnUrls        = new List <String>(cmdlet.GeneralHelp.ReturnUrl.Split(';'));
            List <String> returnDescription = new List <String>(cmdlet.GeneralHelp.ReturnTypeDescription.Split(';'));

            for (Int32 index = 0; index < returnTypes.Count; index++)
            {
                if (index < returnUrls.Count)
                {
                    if (String.IsNullOrEmpty(returnUrls[index]))
                    {
                        SB.Append("<p style=\"margin-left: 40px;\">" + rules.ToHtml(returnTypes[index]) + "</p>" + _nl);
                    }
                    else
                    {
                        SB.Append("<p style=\"margin-left: 40px;\"><a href=\"" + returnUrls[index] + "\">" + rules.ToHtml(returnTypes[index]) + "</a></p>" + _nl);
                    }
                }
                else
                {
                    SB.Append("<p style=\"margin-left: 40px;\">" + rules.ToHtml(returnTypes[index]) + "</p>" + _nl);
                }
                if (index < returnDescription.Count)
                {
                    SB.Append("<p style=\"margin-left: 80px;\">" + rules.ToHtml(returnDescription[index]) + "</p>" + _nl);
                }
            }
        }
コード例 #2
0
        static void htmlGenerateReturnTypes(BBCodeParser rules, StringBuilder SB, CmdletObject cmdlet)
        {
            SB.Append("<h2>Outputs</h2>" + _nl);
            List <String> returnTypes       = new List <String>(cmdlet.GeneralHelp.ReturnType.Split(';'));
            List <String> returnUrls        = new List <String>(cmdlet.GeneralHelp.ReturnUrl.Split(';'));
            List <String> returnDescription = new List <String>(cmdlet.GeneralHelp.ReturnTypeDescription.Split(';'));

            for (Int32 index = 0; index < returnTypes.Count; index++)
            {
                if (index < returnUrls.Count)
                {
                    SB.AppendLine(String.IsNullOrEmpty(returnUrls[index])
                        ? addIndentedParagraphText(rules.ToHtml(returnTypes[index]))
                        : addIndentedParagraphText($"<a href=\"{returnUrls[index]}\">{rules.ToHtml(returnTypes[index])}</a>"));
                }
                else
                {
                    SB.AppendLine(addIndentedParagraphText(rules.ToHtml(returnTypes[index])));
                }
                if (index < returnDescription.Count)
                {
                    SB.AppendLine($"<p style=\"margin-left: 80px;\">{rules.ToHtml(returnDescription[index])}</p>");
                }
            }
        }
コード例 #3
0
        /// <param name="sourceCmdlet">active cmdlet from module</param>
        /// <param name="destinationCmdlet">saved cmdlet in project file</param>
        static void CopyParameters(CmdletObject sourceCmdlet, CmdletObject destinationCmdlet)
        {
            List <String> processed = new List <String>();

            // process saved parameters
            for (Int32 index = 0; index < destinationCmdlet.Parameters.Count; index++)
            {
                Int32 sourceIndex = sourceCmdlet.Parameters.IndexOf(destinationCmdlet.Parameters[index]);
                if (sourceIndex >= 0)
                {
                    // copy user input to source cmdlet
                    sourceCmdlet.Parameters[sourceIndex].Description  = destinationCmdlet.Parameters[index].Description;
                    sourceCmdlet.Parameters[sourceIndex].Globbing     = destinationCmdlet.Parameters[index].Globbing;
                    sourceCmdlet.Parameters[sourceIndex].DefaultValue = destinationCmdlet.Parameters[index].DefaultValue;
                    // replace parameter from source to destination cmdlet
                    destinationCmdlet.Parameters[index] = sourceCmdlet.Parameters[sourceIndex];
                    processed.Add(destinationCmdlet.Parameters[index].Name);
                }
                else
                {
                    // saved cmdlet contains orphaned parameter
                    destinationCmdlet.Parameters[index].Status = ItemStatus.Missing;
                }
            }
            // process active non-processed parameters. They are new parameters
            foreach (ParameterDescription param in sourceCmdlet.Parameters.Where(param => !processed.Contains(param.Name)))
            {
                destinationCmdlet.Parameters.Add(param);
            }
        }
コード例 #4
0
        // generates pure encoded HTML string
        static String GeneratePureHtml(CmdletObject cmdlet, IReadOnlyList <CmdletObject> cmdlets, StringBuilder SB, Boolean useSupports)
        {
            SB.Clear();
            BBCodeParser rules = GetParser(ParserType.Enhanced);

            HtmlgenerateName(SB, cmdlet);
            HtmlGenerateSynopsis(rules, SB, cmdlets, cmdlet);
            HtmlGenerateSyntax(SB, cmdlet);
            HtmlGenerateDescription(rules, SB, cmdlets, cmdlet);
            HtmlGenerateParams(rules, SB, cmdlets, cmdlet);
            HtmlGenerateInputTypes(rules, SB, cmdlet);
            HtmlGenerateReturnTypes(rules, SB, cmdlet);
            HtmlGenerateNotes(rules, SB, cmdlet);
            HtmlGenerateExamples(rules, SB, cmdlet);
            HtmlGenerateRelatedLinks(rules, SB, cmdlets, cmdlet);
            if (useSupports)
            {
                HtmlGenerateSupports(cmdlet, ref SB);
            }
            if (!String.IsNullOrEmpty(cmdlet.ExtraFooter))
            {
                SB.Append(cmdlet.ExtraFooter);
            }
            return(SB.ToString());
        }
コード例 #5
0
 static void XmlGenerateCmdletDetail(BBCodeParser bbRules, StringBuilder SB, CmdletObject cmdlet)
 {
     SB.Append("<!--Generated by PS Cmdlet Help Editor-->" + n);
     SB.Append("	<command:details>" + n);
     SB.Append("		<command:name>");
     SB.Append(SecurityElement.Escape(cmdlet.Name));
     SB.Append("</command:name>" + n);
     // synopsis
     SB.Append("		<maml:description>"+ n);
     SB.Append(generatePragraphs(cmdlet.GeneralHelp.Synopsis, bbRules, 3));
     SB.Append("		</maml:description>"+ n);
     // TODO copyrights
     SB.Append("		<maml:copyright>"+ n);
     SB.Append("			<maml:para />"+ n);
     //SB.Append("		<!--Add copy right info here.-->" + n);
     SB.Append("		</maml:copyright>"+ n);
     SB.Append("		<command:verb>");
     SB.Append(SecurityElement.Escape(cmdlet.Verb));
     SB.Append("</command:verb>" + n);
     SB.Append("		<command:noun>");
     SB.Append(SecurityElement.Escape(cmdlet.Noun));
     SB.Append("</command:noun>" + n);
     //dev version
     SB.Append("		<dev:version />"+ n);
     //End </commnd:details>
     SB.Append("	</command:details>" + n);
     //Add Cmdlet detailed description
     SB.Append("	<maml:description>" + n);
     SB.Append(generatePragraphs(cmdlet.GeneralHelp.Description, bbRules, 2));
     SB.Append("	</maml:description>" + n);
 }
コード例 #6
0
 static void ReadLinks(IEnumerable linkNodes, XmlNamespaceManager ns, CmdletObject currentCmdlet)
 {
     if (linkNodes == null)
     {
         return;
     }
     foreach (XmlNode linkNode in linkNodes)
     {
         RelatedLink link = new RelatedLink();
         // Link name
         XmlNode tempNode = linkNode.SelectSingleNode("maml:linkText", ns);
         if (tempNode != null)
         {
             link.LinkText = tempNode.InnerText.Trim();
             if (String.IsNullOrEmpty(link.LinkText))
             {
                 link.LinkText = "Unknown";
             }
         }
         tempNode = linkNode.SelectSingleNode("maml:uri", ns);
         if (tempNode != null)
         {
             link.LinkUrl = tempNode.InnerText.Trim();
         }
         currentCmdlet.RelatedLinks.Add(link);
     }
 }
コード例 #7
0
        static void htmlGenerateExamples(BBCodeParser rules, StringBuilder SB, CmdletObject cmdlet)
        {
            SB.AppendLine("<h2>Examples</h2>");
            for (Int32 index = 0; index < cmdlet.Examples.Count; index++)
            {
                Example example = cmdlet.Examples[index];
                String  name    = String.IsNullOrEmpty(example.Name)
                    ? $"Example {index + 1}"
                    : example.Name;
                SB.AppendLine($"<h3>{SecurityElement.Escape(name)}</h3>");
                if (!String.IsNullOrEmpty(example.Cmd))
                {
                    String cmd = !example.Cmd.StartsWith("PS C:\\>")
                        ? $"PS C:\\> {example.Cmd}"
                        : example.Cmd;

                    SB.AppendLine($"<pre style=\"margin-left: 40px;\">{SecurityElement.Escape(cmd)}</pre>");
                }

                if (!String.IsNullOrEmpty(example.Output))
                {
                    SB.AppendLine($"<pre style=\"margin-left: 40px;\">{SecurityElement.Escape(example.Output)}</pre>");
                }

                if (!String.IsNullOrEmpty(example.Description))
                {
                    String str = rules.ToHtml(example.Description);
                    SB.AppendLine(addIndentedParagraphText(str));
                }
            }
        }
コード例 #8
0
        static void XmlGenerateReturnTypes(BBCodeParser bbRules, StringBuilder SB, CmdletObject cmdlet)
        {
            List <String> returnTypes       = new List <String>(cmdlet.GeneralHelp.ReturnType.Split(new[] { ';' }));
            List <String> returnUrls        = new List <String>(cmdlet.GeneralHelp.ReturnUrl.Split(new[] { ';' }));
            List <String> returnDescription = new List <String>(cmdlet.GeneralHelp.ReturnTypeDescription.Split(new[] { ';' }, StringSplitOptions.RemoveEmptyEntries));

            SB.Append("	<command:returnValues>" + n);
            for (Int32 index = 0; index < returnTypes.Count; index++)
            {
                SB.Append("		<command:returnValue>"+ n);
                SB.Append("			<dev:type>"+ n);
                SB.Append("				<maml:name>"+ bbRules.ToHtml(returnTypes[index], true) + "</maml:name>" + n);
                try {
                    SB.Append("				<maml:uri>"+ bbRules.ToHtml(returnUrls[index], true) + "</maml:uri>" + n);
                } catch {
                    SB.Append("				<maml:uri />"+ n);
                }
                SB.Append("				<maml:description/>"+ n);
                SB.Append("			</dev:type>"+ n);
                SB.Append("			<maml:description>"+ n);
                try {
                    SB.Append(generatePragraphs(returnDescription[index], bbRules, 4));
                } catch {
                    SB.Append("<maml:para />" + n);
                }
                SB.Append("			</maml:description>"+ n);
                SB.Append("		</command:returnValue>"+ n);
            }
            SB.Append("	</command:returnValues>" + n);
        }
コード例 #9
0
 static void HtmlGenerateExamples(BBCodeParser rules, StringBuilder SB, CmdletObject cmdlet)
 {
     SB.Append("<h2><strong>Examples</strong></h2>" + _nl);
     foreach (Example example in cmdlet.Examples)
     {
         String name = String.IsNullOrEmpty(example.Name) ? "unknown" : example.Name;
         SB.Append("<h3>" + SecurityElement.Escape(name) + "</h3>" + _nl);
         if (!String.IsNullOrEmpty(example.Cmd))
         {
             String cmd;
             if (!example.Cmd.StartsWith("PS C:\\>"))
             {
                 cmd = "PS C:\\> " + example.Cmd;
             }
             else
             {
                 cmd = example.Cmd;
             }
             SB.Append("<pre style=\"margin-left: 40px;\">" + SecurityElement.Escape(cmd) + "</pre>" + _nl);
         }
         if (!String.IsNullOrEmpty(example.Output))
         {
             SB.Append("<pre style=\"margin-left: 40px;\">" + SecurityElement.Escape(example.Output) + "</pre>" + _nl);
         }
         if (!String.IsNullOrEmpty(example.Description))
         {
             String str = rules.ToHtml(example.Description);
             SB.Append("<p style=\"margin-left: 40px;\">" + str + "</p>" + _nl);
         }
     }
 }
コード例 #10
0
 public static Task PublishSingle(CmdletObject cmdlet, ModuleObject module, Blogger blogger, Boolean quiet)
 {
     return(Task.Factory.StartNew(() => {
         var post = new Post {
             Title = cmdlet.Name,
             PostId = cmdlet.ArticleIDString,
             HTML = HtmlProcessor.GenerateHtmlView(cmdlet, module).Result
         };
         if (blogger == null)
         {
             blogger = Utils.InitializeBlogger(module.Provider);
         }
         if (blogger == null)
         {
             Utils.MsgBox("Warning", Strings.WarnBloggerNeedsMoreData, MessageBoxImage.Exclamation);
             return;
         }
         if (String.IsNullOrEmpty(cmdlet.ArticleIDString))
         {
             // assuming that article does not exist
             cmdlet.ArticleIDString = blogger.AddPost(post);
             if (!String.IsNullOrEmpty(cmdlet.ArticleIDString) && !quiet)
             {
                 Utils.MsgBox("Success", new Win32Exception(0).Message, MessageBoxImage.Information);
             }
             // get post URL once published
             if (!String.IsNullOrEmpty(cmdlet.ArticleIDString))
             {
                 try {
                     cmdlet.URL = module.Provider.ProviderName.ToLower() == "codeplex"
                         ? module.Provider.Blog.URL + "wikipage?title=" + cmdlet.Name
                         : blogger.GetPost(cmdlet.ArticleIDString).Permalink;
                     if (!Uri.IsWellFormedUriString(cmdlet.URL, UriKind.Absolute))
                     {
                         var baseUrl = new Uri(module.Provider.ProviderURL);
                         cmdlet.URL = $"{baseUrl.Scheme}://{baseUrl.DnsSafeHost}{cmdlet.URL}";
                     }
                 } catch { }
             }
         }
         else
         {
             try {
                 // assuming that article exist, so we just change it
                 blogger.UpdatePost(post);
                 var baseUrl = new Uri(module.Provider.ProviderURL);
                 String permalink = blogger.GetPost(cmdlet.ArticleIDString).Permalink;
                 cmdlet.URL = $"{baseUrl.Scheme}://{baseUrl.DnsSafeHost}{permalink}";
             } catch (Exception e) {
                 // 0x80131600 connect succeeds, but the post is deleted. Remove postid
                 if (e.HResult == -2146232832 || e.HResult == -2147023728)
                 {
                     cmdlet.ArticleIDString = null;
                 }
                 throw;
             }
         }
     }));
 }
コード例 #11
0
 // generates HTML for HTML source view
 public static Task <IEnumerable <XmlToken> > GenerateHtmlSourceHelp(CmdletObject cmdlet, ModuleObject moduleObject)
 {
     return(Task <IEnumerable <XmlToken> > .Factory.StartNew(() =>
                                                             XmlTokenizer.LoopTokenize(
                                                                 GeneratePureHtml(cmdlet, moduleObject.Cmdlets, new StringBuilder(), moduleObject.UseSupports)
                                                                 )
                                                             ));
 }
コード例 #12
0
 static void htmlGenerateName(StringBuilder SB, CmdletObject cmdlet)
 {
     if (!String.IsNullOrEmpty(cmdlet.ExtraHeader))
     {
         SB.Append(cmdlet.ExtraHeader);
     }
     SB.AppendLine($"<h1 style=\"text-align: center;\">{SecurityElement.Escape(cmdlet.Name)}</h1>");
 }
コード例 #13
0
 static void HtmlGenerateNotes(BBCodeParser rules, StringBuilder SB, CmdletObject cmdlet)
 {
     SB.Append("<h2><strong>Notes</strong></h2>" + _nl);
     if (!String.IsNullOrEmpty(cmdlet.GeneralHelp.Notes))
     {
         String str = rules.ToHtml(GenerateHtmlLink(cmdlet.GeneralHelp.Notes, null));
         SB.Append("<p style=\"margin-left: 40px;\">" + str + "</p>" + _nl);
     }
 }
コード例 #14
0
 static void htmlGenerateNotes(BBCodeParser rules, StringBuilder SB, CmdletObject cmdlet)
 {
     SB.AppendLine("<h2>Notes</h2>");
     if (!String.IsNullOrEmpty(cmdlet.GeneralHelp.Notes))
     {
         String str = rules.ToHtml(generateHtmlLink(cmdlet.GeneralHelp.Notes, null));
         SB.AppendLine(addIndentedParagraphText(str));
     }
 }
コード例 #15
0
 static void HtmlgenerateName(StringBuilder SB, CmdletObject cmdlet)
 {
     if (!String.IsNullOrEmpty(cmdlet.ExtraHeader))
     {
         SB.Append(cmdlet.ExtraHeader);
     }
     //SB.Append("<h2>NAME</h2>" + n);
     SB.Append("<h1 style=\"text-align: center;\"><strong>" + SecurityElement.Escape(cmdlet.Name) + "</strong></h1>" + _nl);
 }
コード例 #16
0
 static void XmlGenerateNotes(BBCodeParser bbRules, StringBuilder SB, CmdletObject cmdlet)
 {
     SB.Append("	<maml:alertSet>" + n);
     SB.Append("		<maml:title></maml:title>"+ n);
     SB.Append("		<maml:alert>"+ n);
     SB.Append(generatePragraphs(cmdlet.GeneralHelp.Notes, bbRules, 3));
     SB.Append("		</maml:alert>"+ n);
     SB.Append("	</maml:alertSet>" + n);
 }
コード例 #17
0
        async void GenerateOutput(Object obj)
        {
            CmdletObject cmd    = Tab.EditorContext.CurrentCmdlet;
            ModuleObject module = Tab.Module;

            if (cmd == null)
            {
                return;
            }

            BusyControlVisible = Visibility.Visible;
            RtbVisible         = Visibility.Collapsed;
            WebBrowserVisible  = Visibility.Collapsed;

            if (HtmlChecked)
            {
                HtmlText = await HtmlProcessor.GenerateHtmlView(cmd, module);

                HtmlText           = String.Format(Properties.Resources.HtmlTemplate, cmd.Name, HtmlText, cmd.ExtraHeader, cmd.ExtraFooter);
                BusyControlVisible = Visibility.Collapsed;
                RtbVisible         = Visibility.Collapsed;
                WebBrowserVisible  = Visibility.Visible;
                return;
            }

            IEnumerable <XmlToken> data = new List <XmlToken>();

            if (XmlChecked)
            {
                if (module.UpgradeRequired)
                {
                    Utils.MsgBox("Warning", "The module is offline and requires upgrade. Upgrade the project to allow XML view.", MessageBoxButton.OK, MessageBoxImage.Warning);
                    BusyControlVisible = Visibility.Collapsed;
                    return;
                }
                List <CmdletObject> cmdlets = new List <CmdletObject> {
                    cmd
                };
                StringBuilder SB = new StringBuilder();
                await XmlProcessor.XmlGenerateHelp(SB, cmdlets, null, module.IsOffline);

                data = XmlTokenizer.LoopTokenize(SB.ToString());
            }
            else if (HtmlSourceChecked)
            {
                data = await HtmlProcessor.GenerateHtmlSourceHelp(cmd, module);
            }
            Paragraph para = new Paragraph();

            para.Inlines.AddRange(ColorizeSource(data));
            Document = new FlowDocument();
            Document.Blocks.Add(para);
            BusyControlVisible = Visibility.Collapsed;
            WebBrowserVisible  = Visibility.Collapsed;
            RtbVisible         = Visibility.Visible;
        }
コード例 #18
0
 static void HtmlGenerateSyntax(StringBuilder SB, CmdletObject cmdlet)
 {
     SB.Append("<h2><strong>Syntax</strong></h2>" + _nl);
     SB.Append("<pre style=\"margin-left: 40px;\">");
     foreach (String syntaxItem in cmdlet.Syntax)
     {
         SB.Append(SecurityElement.Escape(syntaxItem) + " [&lt;CommonParameters&gt;]" + _nl + _nl);
     }
     SB.Append("</pre>" + _nl);
 }
コード例 #19
0
 static Task XmlGenerateBody(BBCodeParser bbRules, StringBuilder SB, CmdletObject cmdlet)
 {
     return(Task.Factory.StartNew(() => {
         SB.Append("<command:command xmlns:maml=\"http://schemas.microsoft.com/maml/2004/10\" xmlns:command=\"http://schemas.microsoft.com/maml/dev/command/2004/10\" xmlns:dev=\"http://schemas.microsoft.com/maml/dev/2004/10\" xmlns:MSHelp=\"http://msdn.microsoft.com/mshelp\">" + n);
         XmlGenerateCmdletDetail(bbRules, SB, cmdlet);
         SB.Append("	<command:syntax>" + n);
         // if current cmdlet hasn't parameters, then just write single syntaxItem
         if (cmdlet.Parameters.Count == 0)
         {
             SB.Append("		<command:syntaxItem>"+ n);
             SB.Append("			<maml:name>");
             SB.Append(SecurityElement.Escape(cmdlet.Name));
             SB.Append("</maml:name>" + n);
             SB.Append("		</command:syntaxItem>"+ n);
         }
         else
         {
             XmlGenerateParameterSyntax(bbRules, SB, cmdlet);
         }
         SB.Append("	</command:syntax>" + n);
         SB.Append("	<command:parameters>");
         if (cmdlet.Parameters.Count > 0)
         {
             SB.Append(n);
             foreach (ParameterDescription item in cmdlet.Parameters.Where(item => item.Status != ItemStatus.Missing))
             {
                 XmlGenerateParameter(bbRules, SB, item);
             }
         }
         SB.Append("	</command:parameters>" + n);
         XmlGenerateInputTypes(bbRules, SB, cmdlet);
         XmlGenerateReturnTypes(bbRules, SB, cmdlet);
         XmlGenerateErrors(SB);
         XmlGenerateNotes(bbRules, SB, cmdlet);
         SB.Append("	<command:examples>" + n);
         if (cmdlet.Examples.Count > 0)
         {
             foreach (Example item in cmdlet.Examples)
             {
                 XmlGenerateExamples(bbRules, SB, item);
             }
         }
         SB.Append("	</command:examples>" + n);
         SB.Append("	<maml:relatedLinks>" + n);
         if (cmdlet.RelatedLinks.Count > 0)
         {
             foreach (RelatedLink link in cmdlet.RelatedLinks)
             {
                 XmlGenerateLinks(SB, link);
             }
         }
         SB.Append("	</maml:relatedLinks>" + n);
         SB.Append("</command:command>" + n);
     }));
 }
コード例 #20
0
        static void ReadExamples(IEnumerable exampleNodes, XmlNamespaceManager ns, CmdletObject currentCmdlet)
        {
            if (exampleNodes == null)
            {
                return;
            }
            foreach (XmlNode exampleNode in exampleNodes)
            {
                Example example = new Example();
                // Example name
                XmlNode tempNode = exampleNode.SelectSingleNode("maml:title", ns);
                if (tempNode != null)
                {
                    example.Name = tempNode.InnerText.Replace("-", String.Empty).Trim();
                    if (String.IsNullOrEmpty(example.Name))
                    {
                        example.Name = "Unknown";
                    }
                }
                // Example command
                tempNode = exampleNode.SelectSingleNode("dev:code", ns);
                if (tempNode != null)
                {
                    example.Cmd = tempNode.InnerText.Trim();
                }
                // Example description
                tempNode = exampleNode.SelectSingleNode("dev:remarks", ns);
                if (tempNode != null)
                {
                    int NodeCount = 0;
                    foreach (XmlNode DescriptionNode in tempNode)
                    {
                        switch (NodeCount)
                        {
                        case 0:
                            example.Description = readParagraphs(DescriptionNode.ChildNodes);
                            break;

                        case 3:
                            example.Output += DescriptionNode.InnerText.Trim();
                            break;
                        }
                        NodeCount++;
                    }
                }
                // Example output
                tempNode = exampleNode.SelectSingleNode("command:commandLines", ns);
                if (tempNode != null)
                {
                    example.Output += tempNode.InnerText.Trim();
                }
                currentCmdlet.Examples.Add(example);
            }
        }
コード例 #21
0
        static void ReadXml(XmlNode commandNode, XmlNamespaceManager ns, CmdletObject currentCmdlet)
        {
            XmlNode tempNode = commandNode.SelectSingleNode("command:details/maml:description", ns);

            // Synopsis
            if (tempNode != null)
            {
                currentCmdlet.GeneralHelp.Synopsis = readParagraphs(tempNode.ChildNodes);
            }
            // Description
            tempNode = commandNode.SelectSingleNode("maml:description", ns);
            if (tempNode != null)
            {
                currentCmdlet.GeneralHelp.Description = readParagraphs(tempNode.ChildNodes);
            }
            if (currentCmdlet.GeneralHelp.Status != ItemStatus.Missing)
            {
                currentCmdlet.GeneralHelp.Status = String.IsNullOrEmpty(currentCmdlet.GeneralHelp.Synopsis) ||
                                                   String.IsNullOrEmpty(currentCmdlet.GeneralHelp.Description)
                                                                                                           ? ItemStatus.Incomplete
                                                                                                           : ItemStatus.Valid;
            }
            // Notes
            tempNode = commandNode.SelectSingleNode("maml:alertSet/maml:alert", ns);
            if (tempNode != null)
            {
                currentCmdlet.GeneralHelp.Notes = readParagraphs(tempNode.ChildNodes);
            }
            // Input type
            XmlNodeList nodes = commandNode.SelectNodes("command:inputTypes/command:inputType", ns);

            ReadTypes(nodes, ns, currentCmdlet, false);
            // Output type
            nodes = commandNode.SelectNodes("command:returnValues/command:returnValue", ns);
            ReadTypes(nodes, ns, currentCmdlet, true);
            // Parameters
            nodes = commandNode.SelectNodes("command:parameters/command:parameter", ns);
            ReadParameters(nodes, ns, currentCmdlet);
            // Examples
            nodes = commandNode.SelectNodes("command:examples/command:example", ns);
            ReadExamples(nodes, ns, currentCmdlet);
            // Related links
            nodes = commandNode.SelectNodes("maml:relatedLinks/maml:navigationLink", ns);
            ReadLinks(nodes, ns, currentCmdlet);
        }
コード例 #22
0
 static void HtmlGenerateRelatedLinks(BBCodeParser rules, StringBuilder SB, IReadOnlyList <CmdletObject> cmdlets, CmdletObject cmdlet)
 {
     SB.Append("<h2><strong>Related links</strong></h2>" + _nl);
     if (cmdlet.RelatedLinks.Count > 0)
     {
         SB.Append("<p style=\"margin-left: 40px;\">" + _nl);
         foreach (RelatedLink link in cmdlet.RelatedLinks.Where(x => x.LinkText.ToLower() != "online version:"))
         {
             SB.Append("	" + rules.ToHtml(GenerateHtmlLink(link.LinkText, cmdlets)));
             if (!String.IsNullOrEmpty(link.LinkUrl))
             {
                 SB.Append("	<a href=\"" + link.LinkUrl + "\">" + link.LinkUrl + "</a>");
             }
             SB.Append("<br />" + _nl);
         }
         SB.Append("</p>");
     }
 }
コード例 #23
0
 // generates HTML for web browser control
 public static Task <String> GenerateHtmlView(CmdletObject cmdlet, ModuleObject moduleObject)
 {
     return(Task <String> .Factory.StartNew(() => GeneratePureHtml(cmdlet, moduleObject.Cmdlets, new StringBuilder(), moduleObject.UseSupports)));
 }
コード例 #24
0
 static void XmlGenerateParameterSyntax(BBCodeParser bbRules, StringBuilder SB, CmdletObject cmdlet)
 {
     String[] exclude =
     {
         "verbose", "debug", "erroraction", "warningaction", "errorvariable", "warningvariable", "outvariable", "outbuffer", "pipelinevariable"
     };
     foreach (CommandParameterSetInfo2 paramSet in cmdlet.ParamSets)
     {
         SB.Append("		<command:syntaxItem>"+ n);
         SB.Append("			<maml:name>"+ SecurityElement.Escape(cmdlet.Name) + "</maml:name>" + n);
         foreach (String paramSetParam in paramSet.Parameters)
         {
             if (exclude.Contains(paramSetParam.ToLower()))
             {
                 continue;
             }
             ParameterDescription param = null;
             string setParam            = paramSetParam;
             foreach (ParameterDescription parameter in cmdlet.Parameters.Where(x => String.Equals(x.Name, setParam, StringComparison.CurrentCultureIgnoreCase)))
             {
                 param = parameter;
             }
             if (param == null)
             {
                 continue;
             }
             SB.Append("			<command:parameter required=\""+ param.Mandatory.ToString().ToLower() + "\"");
             SB.Append(" variableLength=\"" + param.AcceptsArray.ToString().ToLower() + "\"");
             SB.Append(" globbing=\"" + param.Globbing.ToString().ToLower() + "\"");
             SB.Append(" pipelineInput=\"");
             if (param.Pipeline || param.PipelinePropertyName)
             {
                 SB.Append("true");
                 if (param.Pipeline && !param.PipelinePropertyName)
                 {
                     SB.Append(" (ByValue)");
                 }
                 else if (param.Pipeline && param.PipelinePropertyName)
                 {
                     SB.Append(" (ByValue, ByPropertyName)");
                 }
                 else
                 {
                     SB.Append(" (ByPropertyName)");
                 }
             }
             else
             {
                 SB.Append("false");
             }
             SB.Append("\" position=\"" + param.Position + "\">" + n);
             SB.Append("				<maml:name>"+ SecurityElement.Escape(param.Name) + "</maml:name>" + n);
             SB.Append("				<maml:description>"+ n);
             SB.Append(generatePragraphs(param.Description, bbRules, 5));
             SB.Append("				</maml:description>"+ n);
             SB.Append("				<command:parameterValue ");
             String paramValueRequired = "true";
             if (param.Type.ToLower() == "boolean" || param.Type.ToLower() == "switchparameter")
             {
                 paramValueRequired = "false";
             }
             //Additional parameter Values
             SB.Append("required=\"" + paramValueRequired + "\"");
             SB.Append(" variableLength=\"" + param.AcceptsArray.ToString().ToLower() + "\">");
             SB.Append(SecurityElement.Escape(param.Type));
             SB.Append("</command:parameterValue>" + n);
             SB.Append("			</command:parameter>"+ n);
         }
         SB.Append("		</command:syntaxItem>"+ n);
     }
 }
コード例 #25
0
 static void HtmlGenerateParams(BBCodeParser rules, StringBuilder SB, IReadOnlyList <CmdletObject> cmdlets, CmdletObject cmdlet)
 {
     SB.Append("<h2><strong>Parameters</strong></h2>" + _nl);
     foreach (ParameterDescription param in cmdlet.Parameters)
     {
         SB.Append("<h3><strong>-" + SecurityElement.Escape(param.Name) + "</strong> <em style=\"font-weight: 100;\">&lt;" + SecurityElement.Escape(param.Type) + "&gt;</em></h3>" + _nl);
         if (!String.IsNullOrEmpty(param.Description))
         {
             String str = rules.ToHtml(GenerateHtmlLink(param.Description, cmdlets));
             SB.Append("<p style=\"margin-left: 40px; text-align: left;\">" + str + "</p>" + _nl);
         }
         SB.Append("<table border=\"1\" style=\"margin-left: 40px;\">" + _nl);
         SB.Append("	<tbody>" + _nl);
         SB.Append("		<tr>"+ _nl);
         SB.Append("			<td>Required?</td>"+ _nl);
         SB.Append("			<td>"+ Convert.ToString(param.Mandatory) + "</td>" + _nl);
         SB.Append("		</tr>"+ _nl);
         SB.Append("		<tr>"+ _nl);
         SB.Append("			<td>Position?</td>"+ _nl);
         SB.Append("			<td>"+ param.Position + "</td>" + _nl);
         SB.Append("		</tr>"+ _nl);
         SB.Append("		<tr>"+ _nl);
         SB.Append("			<td>Default value</td>"+ _nl);
         if (String.IsNullOrEmpty(param.DefaultValue))
         {
             SB.Append("			<td>&nbsp;</td>"+ _nl);
         }
         else
         {
             SB.Append("			<td>"+ param.DefaultValue + "</td>" + _nl);
         }
         SB.Append("		</tr>"+ _nl);
         SB.Append("		<tr>"+ _nl);
         SB.Append("			<td>Accept pipeline input?</td>"+ _nl);
         if (param.Pipeline || param.PipelinePropertyName)
         {
             SB.Append("			<td>true");
             if (param.Pipeline && !param.PipelinePropertyName)
             {
                 SB.Append(" (ByValue)");
             }
             else if (param.Pipeline && param.PipelinePropertyName)
             {
                 SB.Append(" (ByValue, ByPropertyName)");
             }
             else
             {
                 SB.Append(" (ByPropertyName)");
             }
             SB.Append("</td>" + _nl);
         }
         else
         {
             SB.Append("			<td>false</td>"+ _nl);
         }
         SB.Append("		</tr>"+ _nl);
         SB.Append("		<tr>"+ _nl);
         SB.Append("			<td>Accept wildcard characters?</td>"+ _nl);
         SB.Append("			<td>"+ Convert.ToString(param.Globbing) + "</td>" + _nl);
         SB.Append("		</tr>"+ _nl);
         SB.Append("	</tbody>" + _nl);
         SB.Append("</table>" + _nl);
     }
     // Common parameters
     SB.Append("<h3>&lt;CommonParameters&gt;</h3>" + _nl);
     SB.Append("<p style=\"margin-left: 40px;\">This cmdlet supports the common parameters: Verbose, Debug,<br />" + _nl);
     SB.Append("ErrorAction, ErrorVariable, InformationAction, InformationVariable,<br />" + _nl);
     SB.Append("WarningAction, WarningVariable, OutBuffer, PipelineVariable and OutVariable.<br />" + _nl);
     SB.Append("For more information, see about_CommonParameters (<a href=\"http://go.microsoft.com/fwlink/?LinkID=113216\">http://go.microsoft.com/fwlink/?LinkID=113216</a>).</p>" + _nl);
 }
コード例 #26
0
        // reader
        public static void ImportFromXml(String file, ModuleObject moduleObject)
        {
            if (String.IsNullOrEmpty(file))
            {
                return;
            }
            FileInfo fileInfo   = new FileInfo(file);
            String   supDocPath = fileInfo.DirectoryName + "\\" + moduleObject.Name + ".supports.xml";

            fileInfo = new FileInfo(supDocPath);
            XmlNodeList nodes  = null;
            XmlDocument supDoc = new XmlDocument();

            try {
                if (fileInfo.Exists)
                {
                    supDoc.Load(supDocPath);
                    XmlNode selectSingleNode = supDoc.SelectSingleNode("SupportInformation");
                    if (selectSingleNode == null)
                    {
                        throw new Exception();
                    }
                    nodes = selectSingleNode.SelectNodes("Command");
                }
            } catch { }

            XmlDocument doc = new XmlDocument();

            doc.Load(file);
            XmlNamespaceManager ns = new XmlNamespaceManager(doc.NameTable);

            ns.AddNamespace("command", "http://schemas.microsoft.com/maml/dev/command/2004/10");
            ns.AddNamespace("maml", "http://schemas.microsoft.com/maml/2004/10");
            ns.AddNamespace("dev", "http://schemas.microsoft.com/maml/dev/2004/10");
            XmlNodeList commandNodes = doc.SelectNodes("//command:command", ns);

            if (commandNodes == null)
            {
                Utils.MsgBox("Error", "Error while reading XML.\nThe help file do not contains Command node.", MessageBoxButton.OK, MessageBoxImage.Error);
                return;
            }
            List <String> processed = new List <String>();

            foreach (XmlNode commandNode in commandNodes)
            {
                XmlNode nameNode = commandNode.SelectSingleNode("command:details/command:name", ns);
                if (nameNode == null)
                {
                    continue;
                }
                Boolean isFound = false;
                foreach (CmdletObject cmdlet in moduleObject.Cmdlets)
                {
                    if (String.Equals(nameNode.InnerText.Trim(), cmdlet.Name, StringComparison.CurrentCultureIgnoreCase) && !processed.Contains(cmdlet.Name.ToLower()))
                    {
                        isFound = true;
                        processed.Add(cmdlet.Name);
                        ReadXml(commandNode, ns, cmdlet);
                        try {
                            if (fileInfo.Exists)
                            {
                                ReadSupports(nodes, cmdlet);
                            }
                        } catch { }
                    }
                }
                if (!isFound)
                {
                    CmdletObject currentCmdlet = new CmdletObject(nameNode.InnerText.Trim());
                    ReadXml(commandNode, ns, currentCmdlet);
                    moduleObject.Cmdlets.Add(currentCmdlet);
                }
            }
        }
コード例 #27
0
        static void ReadSupports(IEnumerable nodes, CmdletObject currentCmdlet)
        {
            foreach (XmlNode node in nodes)
            {
                if (node.Attributes == null || node.Attributes["name"].Value != currentCmdlet.Name)
                {
                    continue;
                }
                XmlNodeList currentNode = node.SelectNodes("Info");
                if (currentNode == null)
                {
                    continue;
                }
                foreach (XmlNode tempNode in currentNode)
                {
                    if (tempNode.Attributes == null)
                    {
                        continue;
                    }
                    Boolean value = Convert.ToBoolean(tempNode.Attributes["value"].Value);
                    switch (tempNode.Attributes["name"].Value.ToLower())
                    {
                    case "adrequired": currentCmdlet.SupportInformation.ADChecked = value; break;

                    case "rsatrequired": currentCmdlet.SupportInformation.RsatChecked = value; break;

                    case "ps2": currentCmdlet.SupportInformation.Ps2Checked = value; break;

                    case "ps3": currentCmdlet.SupportInformation.Ps3Checked = value; break;

                    case "ps4": currentCmdlet.SupportInformation.Ps4Checked = value; break;

                    case "winxp": currentCmdlet.SupportInformation.WinXpChecked = value; break;

                    case "winvista": currentCmdlet.SupportInformation.WinVistaChecked = value; break;

                    case "win7": currentCmdlet.SupportInformation.Win7Checked = value; break;

                    case "win8": currentCmdlet.SupportInformation.Win8Checked = value; break;

                    case "win81": currentCmdlet.SupportInformation.Win81Checked = value; break;

                    case "win2k3std": currentCmdlet.SupportInformation.Win2003StdChecked = value; break;

                    case "win2k3ee": currentCmdlet.SupportInformation.Win2003EEChecked = value; break;

                    case "win2k3dc": currentCmdlet.SupportInformation.Win2003DCChecked = value; break;

                    case "win2k8std": currentCmdlet.SupportInformation.Win2008StdChecked = value; break;

                    case "win2k8ee": currentCmdlet.SupportInformation.Win2008EEChecked = value; break;

                    case "win2k8dc": currentCmdlet.SupportInformation.Win2008DCChecked = value; break;

                    case "win2k8r2std": currentCmdlet.SupportInformation.Win2008R2StdChecked = value; break;

                    case "win2k8r2ee": currentCmdlet.SupportInformation.Win2008R2EEChecked = value; break;

                    case "win2k8r2dc": currentCmdlet.SupportInformation.Win2008R2DCChecked = value; break;

                    case "win2k12std": currentCmdlet.SupportInformation.Win2012StdChecked = value; break;

                    case "win2k12dc": currentCmdlet.SupportInformation.Win2012DCChecked = value; break;

                    case "win2k12r2std": currentCmdlet.SupportInformation.Win2012R2StdChecked = value; break;

                    case "win2k12r2dc": currentCmdlet.SupportInformation.Win2012R2DCChecked = value; break;
                    }
                }
            }
        }
コード例 #28
0
 static void ReadParameters(IEnumerable paramNodes, XmlNamespaceManager ns, CmdletObject currentCmdlet)
 {
     if (paramNodes == null)
     {
         return;
     }
     foreach (XmlNode paramNode in paramNodes)
     {
         ParameterDescription foundParam = new ParameterDescription();
         XmlNode tempNode = paramNode.SelectSingleNode("maml:name", ns);
         if (tempNode == null)
         {
             continue;
         }
         Boolean isFound    = false;
         Int32   paramIndex = 0;
         for (Int32 index = 0; index < currentCmdlet.Parameters.Count; index++)
         {
             if (String.Equals(tempNode.InnerText.Trim(), currentCmdlet.Parameters[index].Name, StringComparison.CurrentCultureIgnoreCase))
             {
                 paramIndex = index;
                 isFound    = true;
             }
         }
         if (isFound)
         {
             // Parameter description
             tempNode          = paramNode.SelectSingleNode("maml:description", ns);
             foundParam.Status = ItemStatus.Incomplete;
             if (tempNode != null)
             {
                 currentCmdlet.Parameters[paramIndex].Description = readParagraphs(tempNode.ChildNodes);
                 currentCmdlet.Parameters[paramIndex].Status      = ItemStatus.Valid;
             }
             // Default value
             tempNode = paramNode.SelectSingleNode("dev:defaultValue", ns);
             if (tempNode != null)
             {
                 currentCmdlet.Parameters[paramIndex].DefaultValue = tempNode.InnerText.Trim();
             }
             // Globbing (aka wildcards)
             tempNode = paramNode.SelectSingleNode("@globbing", ns);
             currentCmdlet.Parameters[paramIndex].Globbing = tempNode != null && tempNode.Value.ToLower().Trim() == "true";
         }
         else
         {
             ParameterDescription newParam = new ParameterDescription {
                 Name = tempNode.InnerText.Trim()
             };
             tempNode = paramNode.SelectSingleNode("maml:description", ns);
             // Description
             if (tempNode != null)
             {
                 newParam.Description = readParagraphs(tempNode.ChildNodes);
             }
             // Default value
             tempNode = paramNode.SelectSingleNode("dev:defaultValue", ns);
             if (tempNode != null)
             {
                 newParam.DefaultValue = tempNode.InnerText.Trim();
             }
             // Globbing
             tempNode = paramNode.SelectSingleNode("@globbing", ns);
             // Pipeline input
             tempNode = paramNode.SelectSingleNode("@pipelineInput", ns);
             if (tempNode != null)
             {
                 if (tempNode.InnerText.Trim().Contains("true"))
                 {
                     newParam.Pipeline = true;
                 }
                 if (tempNode.InnerText.Trim().Contains("ByValue"))
                 {
                     newParam.Pipeline = true;
                 }
                 if (tempNode.InnerText.Trim().Contains("ByPropertyName"))
                 {
                     newParam.PipelinePropertyName = true;
                 }
             }
             // Parameter position
             tempNode = paramNode.SelectSingleNode("@position", ns);
             if (tempNode != null)
             {
                 newParam.Position = tempNode.Value.ToLower().Trim();
                 if (newParam.Position.ToLower() != "named")
                 {
                     newParam.Positional = true;
                 }
             }
             // Mandatory
             tempNode = paramNode.SelectSingleNode("@required", ns);
             if (tempNode != null && tempNode.Value.ToLower().Trim() == "true")
             {
                 newParam.Mandatory = true;
             }
             // Parameter type
             tempNode = paramNode.SelectSingleNode("dev:type/maml:name", ns);
             if (tempNode != null)
             {
                 newParam.Type = tempNode.InnerText.Trim().ToLower();
             }
             currentCmdlet.Parameters.Add(newParam);
         }
     }
 }
コード例 #29
0
        static void HtmlGenerateSupports(CmdletObject cmdlet, ref StringBuilder SB)
        {
            String currentHtml = String.Empty;

            if (cmdlet.SupportInformation.ADChecked)
            {
                currentHtml += "<p style=\"color: red; text-align: center;\">[This command is not available in non-domain environments]</p>" + _nl;
            }
            if (cmdlet.SupportInformation.RsatChecked)
            {
                currentHtml += "<p style=\"color: red; text-align: center;\">[This command requires installed Remote Server Administration Tools (RSAT)]</p>" + _nl;
            }
            SB = new StringBuilder(currentHtml + SB);
            SB.Append("<h2><strong>PowerShell Support</strong></h2>" + _nl);
            String psver;

            if (cmdlet.SupportInformation.Ps2Checked)
            {
                psver = "PowerShell 2.0";
            }
            else if (cmdlet.SupportInformation.Ps3Checked)
            {
                psver = "PowerShell 3.0";
            }
            else if (cmdlet.SupportInformation.Ps4Checked)
            {
                psver = "PowerShell 4.0";
            }
            else if (cmdlet.SupportInformation.Ps5Checked)
            {
                psver = "PowerShell 5.0";
            }
            else
            {
                psver = "Any";
            }
            SB.Append("<ul>" + _nl + "	<li>"+ psver + "</li>" + _nl + "</ul>");
            SB.Append("<h2><strong>Operating System Support</strong></h2>" + _nl + "<ul>" + _nl);
            if (cmdlet.SupportInformation.WinXpChecked)
            {
                SB.Append("	<li>Windows XP</li>" + _nl);
            }
            if (cmdlet.SupportInformation.WinVistaChecked)
            {
                SB.Append("	<li>Windows Vista</li>" + _nl);
            }
            if (cmdlet.SupportInformation.Win7Checked)
            {
                SB.Append("	<li>Windows 7</li>" + _nl);
            }
            if (cmdlet.SupportInformation.Win8Checked)
            {
                SB.Append("	<li>Windows 8</li>" + _nl);
            }
            if (cmdlet.SupportInformation.Win81Checked)
            {
                SB.Append("	<li>Windows 8.1</li>" + _nl);
            }
            if (cmdlet.SupportInformation.Win10Checked)
            {
                SB.Append("	<li>Windows 10</li>" + _nl);
            }
            if (cmdlet.SupportInformation.Win2003Checked)
            {
                SB.Append("	<li>Windows Server 2003 all editions</li>" + _nl);
            }
            else
            {
                if (cmdlet.SupportInformation.Win2003StdChecked)
                {
                    SB.Append("	<li>Windows Server 2003 Standard</li>" + _nl);
                }
                if (cmdlet.SupportInformation.Win2003EEChecked)
                {
                    SB.Append("	<li>Windows Server 2003 Enterprise</li>" + _nl);
                }
                if (cmdlet.SupportInformation.Win2003DCChecked)
                {
                    SB.Append("	<li>Windows Server 2003 Datacenter</li>" + _nl);
                }
            }
            if (cmdlet.SupportInformation.Win2008Checked)
            {
                SB.Append("	<li>Windows Server 2008 all editions</li>" + _nl);
            }
            else
            {
                if (cmdlet.SupportInformation.Win2008StdChecked)
                {
                    SB.Append("	<li>Windows Server 2008 Standard</li>" + _nl);
                }
                if (cmdlet.SupportInformation.Win2008EEChecked)
                {
                    SB.Append("	<li>Windows Server 2008 Enterprise</li>" + _nl);
                }
                if (cmdlet.SupportInformation.Win2008DCChecked)
                {
                    SB.Append("	<li>Windows Server 2008 Datacenter</li>" + _nl);
                }
            }
            if (cmdlet.SupportInformation.Win2008R2Checked)
            {
                SB.Append("	<li>Windows Server 2008 R2 all editions</li>" + _nl);
            }
            else
            {
                if (cmdlet.SupportInformation.Win2008R2StdChecked)
                {
                    SB.Append("	<li>Windows Server 2008 R2 Standard</li>" + _nl);
                }
                if (cmdlet.SupportInformation.Win2008R2EEChecked)
                {
                    SB.Append("	<li>Windows Server 2008 R2 Enterprise</li>" + _nl);
                }
                if (cmdlet.SupportInformation.Win2008R2DCChecked)
                {
                    SB.Append("	<li>Windows Server 2008 R2 Datacenter</li>" + _nl);
                }
            }
            if (cmdlet.SupportInformation.Win2012Checked)
            {
                SB.Append("	<li>Windows Server 2012 all editions</li>" + _nl);
            }
            else
            {
                if (cmdlet.SupportInformation.Win2012StdChecked)
                {
                    SB.Append("	<li>Windows Server 2012 Standard</li>" + _nl);
                }
                if (cmdlet.SupportInformation.Win2012DCChecked)
                {
                    SB.Append("	<li>Windows Server 2012 Datacenter</li>" + _nl);
                }
            }
            if (cmdlet.SupportInformation.Win2012R2Checked)
            {
                SB.Append("	<li>Windows Server 2012 R2 all editions</li>" + _nl);
            }
            else
            {
                if (cmdlet.SupportInformation.Win2012R2StdChecked)
                {
                    SB.Append("	<li>Windows Server 2012 R2 Standard</li>" + _nl);
                }
                if (cmdlet.SupportInformation.Win2012R2DCChecked)
                {
                    SB.Append("	<li>Windows Server 2012 R2 Datacenter</li>" + _nl);
                }
            }
            SB.Append("</ul>");
        }
コード例 #30
0
        static void ReadTypes(IEnumerable typeNodes, XmlNamespaceManager ns, CmdletObject currentCmdlet, Boolean output)
        {
            if (typeNodes == null)
            {
                return;
            }
            List <String> types        = new List <String>();
            List <String> url          = new List <String>();
            List <String> descriptions = new List <String>();

            foreach (XmlNode typeNode in typeNodes)
            {
                XmlNode tempNode = typeNode.SelectSingleNode("dev:type/maml:name", ns);
                if (tempNode == null)
                {
                    continue;
                }
                types.Add(tempNode.InnerText.Trim());
                tempNode = typeNode.SelectSingleNode("dev:type/maml:uri", ns);
                if (tempNode != null)
                {
                    url.Add(tempNode.InnerText.Trim());
                }
                String descriptionNodes = null;
                tempNode = typeNode.SelectSingleNode("dev:type/maml:description", ns);
                if (tempNode != null)
                {
                    descriptionNodes += readParagraphs(tempNode.ChildNodes);
                }
                tempNode = typeNode.SelectSingleNode("maml:description", ns);
                if (tempNode != null)
                {
                    descriptionNodes += n + readParagraphs(tempNode.ChildNodes);
                }
                descriptions.Add(descriptionNodes);
            }
            if (output)
            {
                currentCmdlet.GeneralHelp.ReturnType = String.Join(";", types);
                if (url.Count > 0)
                {
                    currentCmdlet.GeneralHelp.ReturnUrl = String.Join(";", url);
                }
                if (descriptions.Count > 0)
                {
                    currentCmdlet.GeneralHelp.ReturnTypeDescription = String.Join(";", descriptions);
                }
            }
            else
            {
                currentCmdlet.GeneralHelp.InputType = String.Join(";", types);
                if (url.Count > 0)
                {
                    currentCmdlet.GeneralHelp.InputUrl = String.Join(";", url);
                }
                if (descriptions.Count > 0)
                {
                    currentCmdlet.GeneralHelp.InputTypeDescription = String.Join(";", descriptions);
                }
            }
        }