public override void Output(List <ccMetric> metrics, List <ErrorInfo> errors, bool verbose) { Console.WriteLine("<ccm>"); foreach (ccMetric metric in metrics) { Console.WriteLine(" <metric>"); Console.WriteLine(" <complexity>{0}</complexity>", metric.CCM); Console.WriteLine(" <unit>{0}</unit>", XmlOutputter.XmlAdjust(metric.Unit)); Console.WriteLine(" <classification>{0}</classification>", metric.Classification); Console.WriteLine(" <file>{0}</file>", metric.Filename); Console.WriteLine(" <startLineNumber>{0}</startLineNumber>", metric.StartLineNumber); Console.WriteLine(" <endLineNumber>{0}</endLineNumber>", metric.EndLineNumber); Console.WriteLine(" <SLOC>{0}</SLOC>", (metric.EndLineNumber - metric.StartLineNumber).ToString()); Console.WriteLine(" </metric>"); } if (verbose && (errors.Count > 0)) { Console.WriteLine(" <errors>"); foreach (ErrorInfo error in errors) { Console.WriteLine(" <error>"); Console.WriteLine(" <file>{0}</file>", error.File); Console.WriteLine(" <message>{0}</message>", error.Message); Console.WriteLine(" </error>"); } Console.WriteLine(" </errors>"); } Console.WriteLine("</ccm>"); }
public override void Output(TextWriter Stream, List <ccMetric> metrics, List <ErrorInfo> errors, bool verbose) { Stream.WriteLine("<?xml version=\"1.0\" encoding=\"UTF-8\"?>"); if (!string.IsNullOrEmpty(XmlStyleSheet)) { Stream.WriteLine("<?xml-stylesheet type=\"text/xsl\" href=\"" + XmlStyleSheet + "\"?>"); } Stream.WriteLine("<ccm>"); foreach (ccMetric metric in metrics) { Stream.WriteLine(" <metric>"); Stream.WriteLine(" <complexity>{0}</complexity>", metric.CCM); Stream.WriteLine(" <unit>{0}</unit>", XmlOutputter.XmlAdjust(metric.Unit)); Stream.WriteLine(" <testability>{0}</testability>", metric.Testability); Stream.WriteLine(" <classification>{0}</classification>", metric.Classification); Stream.WriteLine(" <file>{0}</file>", metric.Filename); Stream.WriteLine(" <startLineNumber>{0}</startLineNumber>", metric.StartLineNumber); Stream.WriteLine(" <endLineNumber>{0}</endLineNumber>", metric.EndLineNumber); Stream.WriteLine(" <SLOC>{0}</SLOC>", (metric.EndLineNumber - metric.StartLineNumber).ToString()); Stream.WriteLine(" </metric>"); } if (verbose && (errors.Count > 0)) { Stream.WriteLine(" <errors>"); foreach (ErrorInfo error in errors) { Stream.WriteLine(" <error>"); Stream.WriteLine(" <file>{0}</file>", error.File); Stream.WriteLine(" <message>{0}</message>", error.Message); Stream.WriteLine(" </error>"); } Stream.WriteLine(" </errors>"); } Stream.WriteLine("</ccm>"); }