System.Web.Helpers.ServerInfo.PrintInfoSection C# (CSharp) Method

PrintInfoSection() private static method

Renders a table section printing out rows and columns.
private static PrintInfoSection ( StringBuilder builder, string sectionTitle, string>.IDictionary entries ) : void
builder System.Text.StringBuilder
sectionTitle string
entries string>.IDictionary
return void
        private static void PrintInfoSection(StringBuilder builder, string sectionTitle, IDictionary<string, string> entries)
        {
            builder.AppendLine("<div class=\"server-info\">");
            builder.AppendLine("<table class=\"server-info\" dir=\"ltr\">");
            if (!String.IsNullOrEmpty(sectionTitle))
            {
                builder.AppendLine("<caption>");
                builder.AppendFormat(CultureInfo.InvariantCulture, "<h2>{0}</h2>", HttpUtility.HtmlEncode(sectionTitle)).AppendLine();
                builder.AppendLine("</caption>");
            }
            builder.AppendLine("<colgroup><col style=\"width:30%;\" /> <col style=\"width:70%;\"  /></colgroup>");
            builder.AppendLine("<tbody>");
            foreach (var entry in entries)
            {
                var css = String.Empty;
                string value = entry.Value;
                if (entry.Key == HelpersResources.ServerInfo_LegacyCAS)
                {
                    // TODO: suboptimal solution, but its easier to do this than come up with something that works better
                    css = "warn";
                }
                else if (String.IsNullOrEmpty(entry.Value))
                {
                    css = "ital";
                    value = HelpersResources.ServerInfo_NoValue;
                }
                if (css.Any())
                {
                    css = " class=\"" + css + "\"";
                }
                builder.Append("<tr>");
                builder.AppendFormat(CultureInfo.InvariantCulture, "<th scope=\"row\">{0}</th>", HttpUtility.HtmlEncode(entry.Key));
                builder.AppendFormat(CultureInfo.InvariantCulture, "<td{0}>{1}</td>", css, HttpUtility.HtmlEncode(value));
                builder.AppendLine("</tr>");
            }
            builder.AppendLine("</tbody>");
            builder.AppendLine("</table>");
            builder.AppendLine("</div>");
        }