public void Run(IEnumerable <string> args) { var extras = _optionSet.Parse(args); foreach (var arg in PathHelper.ExpandPaths(extras)) { var absolutePath = Path.GetFullPath(arg); var assembly = Assembly.LoadFrom(absolutePath); var assemblyInfo = new AssemblyInfo(); assemblyInfo.ReadAssembly(assembly, _excludePattern); if (_version != null) { assemblyInfo.Version = _version; } var outputPath = PathHelper.FormatPath(_output, assemblyInfo); PathHelper.EnsureFolderExists(outputPath); using (var xmlWriter = new XmlTextWriter(outputPath, Encoding.UTF8) { Formatting = Formatting.Indented }) { assemblyInfo.WriteXml(xmlWriter); } } }
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(); } } } }