Beispiel #1
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();
        }