Ejemplo n.º 1
0
        /// <summary>
        /// Applies the default help keyword to the given help text.
        /// </summary>
        /// <param name="helpText">Help text to apply the default keyword to.</param>
        /// <returns>Processed help</returns>
        private IXmlCommentHelpParagraph GetFallbackDescription(string helpText)
        {
            if (string.IsNullOrWhiteSpace(helpText))
            {
                return(null);
            }

            IList <string> slittedByNewLine = helpText.Split('\n');
            XmlHelpKeyword xmlHelp          = new XmlHelpKeyword(XmlHelpOptions.Default.DefaultXmlHelpKeyword);

            foreach (string line in slittedByNewLine)
            {
                xmlHelp.Add(line);
            }

            return(xmlHelp);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Main implementation of the help parser
        /// </summary>
        /// <param name="helpContent">Help text to parse</param>
        /// <returns>Parsed help</returns>
        private IXmlHelp DoParseXmlHelp(IEnumerable <string> helpContent)
        {
            IXmlHelp       keywords = new XmlHelp();
            XmlHelpKeyword currentXmlHelpKeyword = null;

            foreach (string lineValue in helpContent)
            {
                string trimmedLine = lineValue.Trim();
                if (XmlHelpKeyword.IsKeyword(trimmedLine))
                {
                    currentXmlHelpKeyword = new XmlHelpKeyword(trimmedLine);
                    keywords.Add(currentXmlHelpKeyword);
                }
                else
                {
                    currentXmlHelpKeyword?.Add(trimmedLine);
                }
            }
            return(keywords);
        }