Esempio n. 1
0
        private static void AppendFormat(XmlReader reader, StringBuilder output, string tagName)
        {
            var inner          = reader.ReadInnerXml();
            var formattedInner = CommentFormatting.FormatInnerContent(inner);

            output.Append($"/// <{tagName}>\r\n{formattedInner}/// </{tagName}>\r\n");
        }
Esempio n. 2
0
        private static void AppendFormattedOutputWithAttributes(XmlReader reader, StringBuilder output, string tagName, string attributeTypeName)
        {
            var attributeName = reader.HasAttributes ? reader.GetAttribute(0) : string.Empty;

            var inner = reader.ReadInnerXml();

            // Construct the string (sans the ///) and see if its length is reasonable.
            if (IsShortEnough($"<{tagName} {attributeTypeName }={attributeName}>{inner}</{tagName}>", upperBound: 115))
            {
                output.Append($"/// <{tagName} {attributeTypeName }=\"{attributeName}\">{inner.Trim()}</{tagName}>\r\n");
            }
            else
            {
                var formattedInner = CommentFormatting.FormatInnerContent(inner);
                output.Append($"/// <{tagName} {attributeTypeName }=\"{attributeName}\">\r\n{formattedInner}/// </{tagName}>\r\n");
            }
        }