示例#1
0
 /// <summary>Initializes a new instance of the <see cref="MarkdownReport"/> class.</summary>
 /// <param name="assemblyPropertiesInfo">The assembly properties information.</param>
 /// <param name="hierarchy">The assembly hierarchy.</param>
 /// <param name="reportSettings">The report settings.</param>
 public MarkdownReport(AssemblyPropertiesInfo assemblyPropertiesInfo, HierarchyTree hierarchy, ReportSettings reportSettings) : base(Path.GetFileNameWithoutExtension(assemblyPropertiesInfo.Location), assemblyPropertiesInfo.AssemblyDirectory.FullName)
 {
     // Initialize variables
     AssemblyPropertiesInfo = assemblyPropertiesInfo;
     HierarchyTree          = hierarchy;
     ReportSettings         = reportSettings;
 }
 /// <summary>Initializes a new instance of the <see cref="AssemblyAnalyzer"/> class.</summary>
 public AssemblyAnalyzer()
 {
     AssemblyPropertiesInfo = new AssemblyPropertiesInfo();
     HierarchyTree          = new HierarchyTree();
     Location = string.Empty;
     Settings = new ReportSettings();
 }
        /// <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);
            }
        }
示例#5
0
        /// <summary>Generates the report.</summary>
        /// <param name="assemblyPropertiesInfo">The assembly properties information.</param>
        /// <param name="hierarchy">The hierarchy.</param>
        /// <param name="reportSettings">The report settings.</param>
        public void GenerateReport(AssemblyPropertiesInfo assemblyPropertiesInfo, HierarchyTree hierarchy, ReportSettings reportSettings)
        {
            AssemblyPropertiesInfo = assemblyPropertiesInfo;
            HierarchyTree          = hierarchy;
            ReportSettings         = reportSettings;

            // Begin the generation process for the report.
            StringBuilder reportBuilder = new StringBuilder();

            // Header
            reportBuilder.AppendLine(MarkdownElement.CreateComment(@"Initialize Document Variables"));
            reportBuilder.AppendLine();

            // Generate Top link
            reportBuilder.AppendLine(HtmlUtil.GenerateBackToTop()[0]);
            reportBuilder.AppendLine();

            // Loop thru each member info type and register the commonly used variables for the markdown document.
            //foreach (MarkdownTypeId reference in GetCategoryTypes(ReportSettings))
            //{
            // Create a comment to separate the categories.
            //reportBuilder.AppendLine(MarkdownElement.CreateComment($@"ID: {reference.ID} Variables"));

            // Create the image source reference variables.
            //string imageTypeSource = reference.ImageTypeSource;
            //reportBuilder.AppendLine(imageTypeSource);
            //}

            // Create visual document content
            reportBuilder.AppendLine(HtmlUtil.GenerateHTMLTextCode(HorizontalAlign.Center, @"Assembly Report", "h2"));

            // Render assembly report information
            string italicAssemblyLocation = MarkdownEmphasis.CreateEmphasis(AssemblyPropertiesInfo.FileName, MarkdownEmphasis.EmphasisType.Italic);

            reportBuilder.AppendLine(MarkdownHeader.CreateHeader(@"Assembly: " + italicAssemblyLocation, 6));

            string italicAssemblyExportedTypes = MarkdownEmphasis.CreateEmphasis(Convert.ToString(ReportSettings.ExportedTypes), MarkdownEmphasis.EmphasisType.Italic);

            reportBuilder.AppendLine(MarkdownHeader.CreateHeader(@"Exported Types: " + italicAssemblyExportedTypes, 6));

            string italicAssemblyMissingDocumentation = MarkdownEmphasis.CreateEmphasis(Convert.ToString(ReportSettings.MissingDocumentation.Count), MarkdownEmphasis.EmphasisType.Italic);

            reportBuilder.AppendLine(MarkdownHeader.CreateHeader(@"Missing Documentation: " + italicAssemblyMissingDocumentation, 6));

            string italicTimestampGenerated = MarkdownEmphasis.CreateEmphasis(DateTime.Now.ToLongDateString() + " - " + DateTime.Now.ToLongTimeString(), MarkdownEmphasis.EmphasisType.Italic);

            reportBuilder.AppendLine(MarkdownHeader.CreateHeader(@"Generated: " + italicTimestampGenerated, 6));

            // Draw splitter
            reportBuilder.AppendLine();
            reportBuilder.AppendLine(DocumentSeparator);
            reportBuilder.AppendLine();

            // Generate architecture sections and their images.
            if (HierarchyTree.Classes.Count > 0)
            {
                reportBuilder.AppendLine(GenerateSection(MemberInfoTypes.Class, "Classes", "Class", reportSettings, HierarchyTree.Classes));
            }

            if (HierarchyTree.Delegates.Count > 0)
            {
                reportBuilder.AppendLine(GenerateSection(MemberInfoTypes.Delegate, "Delegates", "Delegate", reportSettings, HierarchyTree.Delegates));
            }

            if (HierarchyTree.Enumerators.Count > 0)
            {
                reportBuilder.AppendLine(GenerateSection(MemberInfoTypes.Enumerator, "Enumerators", "Enumerator", reportSettings, HierarchyTree.Enumerators));
            }

            if (HierarchyTree.Events.Count > 0)
            {
                reportBuilder.AppendLine(GenerateSection(MemberInfoTypes.Event, "Events", "Event", reportSettings, HierarchyTree.Events));
            }

            if (HierarchyTree.Interfaces.Count > 0)
            {
                reportBuilder.AppendLine(GenerateSection(MemberInfoTypes.Interface, "Interfaces", "Interface", reportSettings, HierarchyTree.Interfaces));
            }

            if (HierarchyTree.Structures.Count > 0)
            {
                reportBuilder.AppendLine(GenerateSection(MemberInfoTypes.Structure, "Structures", "Structure", reportSettings, HierarchyTree.Structures));
            }

            reportBuilder.AppendLine(DocumentSeparator);
            reportBuilder.AppendLine();
            reportBuilder.Append(HtmlUtil.GenerateBackToTop()[1]);

            Contents = reportBuilder.ToString();
        }
示例#6
0
 /// <summary>Refreshes the dashboard property grids.</summary>
 /// <param name="assemblyPropertiesInfo">The assembly properties information.</param>
 /// <param name="settings">The settings.</param>
 public void ReloadDashboardPropertyGrids(AssemblyPropertiesInfo assemblyPropertiesInfo, ReportSettings settings)
 {
     Pg_AssemblyDashboardInformation.SelectedObject    = assemblyPropertiesInfo;
     Pg_AssemblyDashboardReportSettings.SelectedObject = settings;
 }