/// <summary>Initializes a new instance of the <see cref="AssemblyAnalyzer"/> class.</summary> /// <param name="assemblyPath">The assembly file path.</param> public AssemblyAnalyzer(string assemblyPath) : this() { // Validate the assembly path if (string.IsNullOrEmpty(assemblyPath)) { throw new ArgumentNullException(nameof(assemblyPath), @"The file name cannot be null or empty."); } if (!File.Exists(assemblyPath)) { throw new FileNotFoundException(@"The assembly file name cannot be found!", assemblyPath); } if (!AsmUtil.IsAssembly(assemblyPath)) { throw new ArgumentNullException(nameof(assemblyPath), @"The file name is not an assembly file (*.DLL;*.EXE)."); } // Initialize Location = assemblyPath; AssemblyPropertiesInfo = new AssemblyPropertiesInfo(assemblyPath); HierarchyTree = new HierarchyTree(assemblyPath); AssemblyReport = new MarkdownReport(AssemblyPropertiesInfo, HierarchyTree, Settings); Settings = new ReportSettings(AssemblyPropertiesInfo, HierarchyTree); }
/// <summary>Analyze the Assembly.</summary> /// <param name="assemblyPath">The assembly to analyze.</param> public void Analyze(string assemblyPath) { try { // Update the assembly path to analyze start scanning Location = assemblyPath; AssemblyPropertiesInfo = new AssemblyPropertiesInfo(assemblyPath); HierarchyTree = new HierarchyTree(assemblyPath); AssemblyReport = new MarkdownReport(AssemblyPropertiesInfo, HierarchyTree, Settings); Settings = new ReportSettings(AssemblyPropertiesInfo, HierarchyTree); // Generate a new assembly report. AssemblyReport.GenerateReport(AssemblyPropertiesInfo, HierarchyTree, Settings); } catch (Exception e) { Console.WriteLine(e); } }