Пример #1
0
        private void GenerateSummaryPage(Worksheet summaryPage, ReportingResult analysisResult)
        {
            var targetNames = _mapper.GetTargetNames(analysisResult.Targets, alwaysIncludeVersion: true);

            // This is the submission id
            summaryPage.AddRow(LocalizedStrings.SubmissionId, AddSubmissionLink(analysisResult.SubmissionId));

            // This is the description of the app
            summaryPage.AddRow(LocalizedStrings.Description, _description);

            // This is the target list that was submitted to the service.
            summaryPage.AddRow(LocalizedStrings.Targets, string.Join(",", targetNames));

            // Add an empty row.
            summaryPage.AddRow();

            if (analysisResult.GetAssemblyUsageInfo().Any())
            {
                var assemblyInfoHeader = new List <string> {
                    LocalizedStrings.AssemblyHeader, "Target Framework"
                };
                assemblyInfoHeader.AddRange(targetNames);
                int tableRowCount = 0;

                summaryPage.AddRow(assemblyInfoHeader.ToArray());
                tableRowCount++;

                foreach (var item in analysisResult.GetAssemblyUsageInfo().OrderBy(a => a.SourceAssembly.AssemblyIdentity))
                {
                    var summaryData = new List <object>()
                    {
                        analysisResult.GetNameForAssemblyInfo(item.SourceAssembly), item.SourceAssembly.TargetFrameworkMoniker ?? string.Empty
                    };

                    // TODO: figure out how to add formatting to cells to show percentages.
                    summaryData.AddRange(item.UsageData.Select(pui => (object)Math.Round(pui.PortabilityIndex * 100.0, 2)));
                    summaryPage.AddRow(summaryData.ToArray());
                    tableRowCount++;
                }

                summaryPage.AddConditionalFormatting(6, analysisResult.GetAssemblyUsageInfo().Count(), 3, analysisResult.Targets.Count);
                summaryPage.AddTable(5, tableRowCount, 1, assemblyInfoHeader.ToArray());

                var columnWidths = new List <double>
                {
                    ColumnWidths.SummaryPage.AssemblyName,
                    ColumnWidths.SummaryPage.TFM
                };

                columnWidths.AddRange(Enumerable.Repeat(ColumnWidths.Targets, analysisResult.Targets.Count)); // Targets

                summaryPage.AddColumnWidth(columnWidths);
            }

            summaryPage.AddRow();
            summaryPage.AddRow(LocalizedStrings.CatalogLastUpdated, _catalogLastUpdated.ToString("D", CultureInfo.CurrentCulture));
            summaryPage.AddRow(LocalizedStrings.HowToReadTheExcelTable);
        }
Пример #2
0
 public RazorHtmlObject(AnalyzeResponse response, ITargetMapper targetMapper)
 {
     _targetMapper = targetMapper;
     RequestFlags = response.ReportingResult.RequestFlags;
     ReportingResult = response.ReportingResult;
     TargetMapper = _targetMapper;
     OrderedUnresolvedAssemblies = response.ReportingResult.GetUnresolvedAssemblies().OrderBy(asm => asm.Key);
     OrderedAssembliesByIdentity = response.ReportingResult.GetAssemblyUsageInfo().OrderBy(a => a.SourceAssembly.AssemblyIdentity);
     MissingTypes = response.ReportingResult.GetMissingTypes();
     TargetHeaders = _targetMapper.GetTargetNames(response.ReportingResult.Targets, true);
     OrderedBreakingChangesByAssembly = GetGroupedBreakingChanges(response.BreakingChanges, response.ReportingResult.GetAssemblyUsageInfo().Select(a => a.SourceAssembly));
     BreakingChangesSummary = GetBreakingChangesSummary(OrderedBreakingChangesByAssembly);
     OrderedBreakingChangeSkippedAssemblies = response.BreakingChangeSkippedAssemblies.OrderBy(a => a.AssemblyIdentity);
 }
Пример #3
0
 public RazorHtmlObject(AnalyzeResponse response, ITargetMapper targetMapper)
 {
     _targetMapper                          = targetMapper;
     RequestFlags                           = response.ReportingResult.RequestFlags;
     ReportingResult                        = response.ReportingResult;
     TargetMapper                           = _targetMapper;
     OrderedUnresolvedAssemblies            = response.ReportingResult.GetUnresolvedAssemblies().OrderBy(asm => asm.Key);
     OrderedAssembliesByIdentity            = response.ReportingResult.GetAssemblyUsageInfo().OrderBy(a => a.SourceAssembly.AssemblyIdentity);
     MissingTypes                           = response.ReportingResult.GetMissingTypes();
     TargetHeaders                          = _targetMapper.GetTargetNames(response.ReportingResult.Targets, true);
     OrderedBreakingChangesByAssembly       = GetGroupedBreakingChanges(response.BreakingChanges, response.ReportingResult.GetAssemblyUsageInfo().Select(a => a.SourceAssembly));
     BreakingChangesSummary                 = GetBreakingChangesSummary(OrderedBreakingChangesByAssembly);
     OrderedBreakingChangeSkippedAssemblies = response.BreakingChangeSkippedAssemblies.OrderBy(a => a.AssemblyIdentity);
 }
        public RazorHtmlObject(AnalyzeResponse response, ITargetMapper targetMapper)
        {
            CatalogBuiltOn              = response.CatalogLastUpdated;
            _targetMapper               = targetMapper;
            RequestFlags                = response.ReportingResult.RequestFlags;
            ReportingResult             = response.ReportingResult;
            TargetMapper                = _targetMapper;
            OrderedUnresolvedAssemblies = response.ReportingResult.GetUnresolvedAssemblies().OrderBy(asm => asm.Key);
            OrderedAssembliesByIdentity = response.ReportingResult.GetAssemblyUsageInfo().OrderBy(a => a.SourceAssembly.AssemblyIdentity);
            MissingTypes                = response.ReportingResult.GetMissingTypes();
            Targets       = response.Targets;
            TargetHeaders = _targetMapper.GetTargetNames(response.ReportingResult.Targets, true);
            OrderedBreakingChangesByAssembly = GetGroupedBreakingChanges(response.BreakingChanges, response.ReportingResult.GetAssemblyUsageInfo().Select(a => a.SourceAssembly));
            BreakingChangesSummary           = GetBreakingChangesSummary(OrderedBreakingChangesByAssembly);

            var skippedAssemblies = response.BreakingChangeSkippedAssemblies ?? Enumerable.Empty <AssemblyInfo>();

            OrderedBreakingChangeSkippedAssemblies = skippedAssemblies.OrderBy(a => a.AssemblyIdentity);
            NuGetPackages = response.NuGetPackages;
        }