public void Run(IEnumerable<string> args) { var extras = _optionSet.Parse(args); var assemblies = new List<AssemblyInfo>(); foreach (string arg in PathHelper.ExpandPaths(extras)) { var assemblyInfo = new AssemblyInfo(); using (var xmlReader = new XmlTextReader(arg)) { assemblyInfo.ReadXml(xmlReader); } assemblies.Add(assemblyInfo); } foreach (var group in assemblies.GroupBy(a => a.Name)) { var reporter = new Reporter(); foreach (var assembly in group) { reporter.Assemblies.Add(assembly); } var report = reporter.GenerateReport(); var outputPath = PathHelper.FormatPath(_output, report); PathHelper.EnsureFolderExists(outputPath); using (var xmlWriter = new XmlTextWriter(outputPath, Encoding.UTF8) { Formatting = Formatting.Indented }) { report.WriteXml(xmlWriter); } if (!string.IsNullOrEmpty(_transform)) { var transform = new XslCompiledTransform(); transform.Load(_transform); var document = new XPathDocument(outputPath); var transformOutput = PathHelper.FormatPath(_transformOutput, report); using (var stream = new FileStream(transformOutput, FileMode.Create)) { transform.Transform(document, null, stream); stream.Flush(); } } } }
private AssemblyInfo LoadReport(string path) { var report = new AssemblyInfo(); report.ReadXml(new XmlTextReader(path)); return report; }