Exemple #1
0
        public static void PrintLine(this SummaryTable table, string[] line, ILogger logger, string leftDel, string rightDel,
                                     bool highlightRow, bool startOfGroup, MarkdownExporter.MarkdownHighlightStrategy startOfGroupHighlightStrategy, string boldMarkupFormat, bool escapeHtml)
        {
            for (int columnIndex = 0; columnIndex < table.ColumnCount; columnIndex++)
            {
                if (!table.Columns[columnIndex].NeedToShow)
                {
                    continue;
                }

                var text = (startOfGroup && (startOfGroupHighlightStrategy == MarkdownExporter.MarkdownHighlightStrategy.Bold))
                    ? BuildBoldText(table, line, leftDel, rightDel, columnIndex, boldMarkupFormat)
                    : BuildStandardText(table, line, leftDel, rightDel, columnIndex);
                if (escapeHtml)
                {
                    text = text.HtmlEncode();
                }

                if (highlightRow) // write the row in an alternative colour
                {
                    logger.WriteHeader(text);
                }
                else
                {
                    logger.WriteStatistic(text);
                }
            }

            if (startOfGroup && (startOfGroupHighlightStrategy == MarkdownExporter.MarkdownHighlightStrategy.Marker))
            {
                logger.Write(highlightRow ? LogKind.Header : LogKind.Statistic, " ^"); //
            }
            logger.WriteLine();
        }
        public static void PrintLine(this SummaryTable table, string[] line, ILogger logger, string leftDel, string rightDel,
                                     bool highlightRow, bool startOfGroup, bool startOfGroupInBold, string boldMarkupFormat)
        {
            for (int columnIndex = 0; columnIndex < table.ColumnCount; columnIndex++)
            {
                if (!table.Columns[columnIndex].NeedToShow)
                {
                    continue;
                }

                var text = (startOfGroup && startOfGroupInBold)
                    ? BuildBoldText(table, line, leftDel, rightDel, columnIndex, boldMarkupFormat)
                    : BuildStandardText(table, line, leftDel, rightDel, columnIndex);

                if (highlightRow) // write the row in an alternative colour
                {
                    logger.WriteHeader(text);
                }
                else
                {
                    logger.WriteStatistic(text);
                }
            }

            logger.WriteLine();
        }
        public static void PrintLine(this SummaryTable table, string[] line, ILogger logger, string leftDel, string rightDel,
                                     bool highlightRow, bool startOfGroup, bool startOfGroupInBold)
        {
            for (int columnIndex = 0; columnIndex < table.ColumnCount; columnIndex++)
            {
                if (!table.Columns[columnIndex].NeedToShow)
                {
                    continue;
                }

                var text = (startOfGroup && startOfGroupInBold)
                    ? BuildBoldText(table, line, leftDel, rightDel, columnIndex)
                    : BuildStandardText(table, line, leftDel, rightDel, columnIndex);

                if (highlightRow) // write the row in an alternative colour
                {
                    logger.WriteHeader(text);
                }
                else
                {
                    logger.WriteStatistic(text);
                }
            }

            logger.WriteLine();
        }
Exemple #4
0
 public static void PrintLine(this SummaryTable table, string[] line, ILogger logger, string leftDel = "", string rightDel = "")
 {
     for (int columnIndex = 0; columnIndex < table.ColumnCount; columnIndex++)
     {
         if (table.Columns[columnIndex].NeedToShow)
         {
             logger.WriteStatistic(leftDel + line[columnIndex].PadLeft(table.Columns[columnIndex].Width, ' ') + rightDel);
         }
     }
 }
Exemple #5
0
        public static void PrintLine(this SummaryTable table, string[] line, ILogger logger, string leftDel, string rightDel)
        {
            for (int columnIndex = 0; columnIndex < table.ColumnCount; columnIndex++)
            {
                if (table.Columns[columnIndex].NeedToShow)
                {
                    logger.WriteStatistic(BuildStandardText(table, line, leftDel, rightDel, columnIndex));
                }
            }

            logger.WriteLine();
        }
Exemple #6
0
        private static void PrintLine(SummaryTable table, string[] line, ILogger logger, string leftDel, string rightDel)
        {
            for (int columnIndex = 0; columnIndex < table.ColumnCount; columnIndex++)
            {
                if (table.Columns[columnIndex].NeedToShow)
                {
                    logger.WriteStatistic(leftDel + line[columnIndex].HtmlEncode() + rightDel);
                }
            }

            logger.WriteLine();
        }
        public static void PrintLine(this SummaryTable table, string[] line, ILogger logger, string leftDel, string rightDel)
        {
            for (int columnIndex = 0; columnIndex < table.ColumnCount; columnIndex++)
            {
                if (table.Columns[columnIndex].NeedToShow)
                {
                    logger.WriteStatistic(BuildStandardText(table, line, leftDel, rightDel, columnIndex));
                }
            }

            logger.WriteLine();
        }
Exemple #8
0
        private static void Diff(TypeDefinition type1, TypeDefinition type2, ILogger logger)
        {
            try
            {
                logger.WriteStatistic($"Diff {type1.FullName}");

                if (IgnoredTypeNames.Contains(type1.FullName) && type2 == null)
                {
                    logger.WriteLineInfo(" SKIPPED.");
                    return;
                }

                logger.WriteLine();

                DiffDefinition(type1, type2);

                DiffMembers(type1, type2, logger);
            }
            catch (Exception ex)
            {
                logger.WriteLineError(ex.ToString());
                throw;
            }
        }
Exemple #9
0
        private void PrintTable(SummaryTable table, ILogger logger)
        {
            if (table.FullContent.Length == 0)
            {
                logger.WriteLineError("There are no benchmarks found ");
                logger.WriteLine();
                return;
            }

            table.PrintCommonColumns(logger);
            logger.WriteLine();

            if (UseCodeBlocks)
            {
                logger.Write(CodeBlockEnd);
                logger.WriteLine();
            }

            if (ColumnsStartWithSeparator)
            {
                logger.WriteStatistic(TableHeaderSeparator.TrimStart());
            }

            table.PrintLine(table.FullHeader, logger, string.Empty, TableHeaderSeparator);
            if (UseHeaderSeparatingRow)
            {
                if (ColumnsStartWithSeparator)
                {
                    logger.WriteStatistic(TableHeaderSeparator.TrimStart());
                }

                logger.WriteLineStatistic(string.Join("",
                                                      table.Columns.Where(c => c.NeedToShow).Select(column => new string('-', column.Width) + GetJustificationIndicator(column.Justify) + "|")));
            }

            int  rowCounter    = 0;
            bool highlightRow  = false;
            var  separatorLine = Enumerable.Range(0, table.ColumnCount).Select(_ => "").ToArray();

            foreach (var line in table.FullContent)
            {
                if (rowCounter > 0 && table.FullContentStartOfLogicalGroup[rowCounter] && table.SeparateLogicalGroups)
                {
                    // Print logical separator
                    if (ColumnsStartWithSeparator)
                    {
                        logger.WriteStatistic(TableColumnSeparator.TrimStart());
                    }
                    table.PrintLine(separatorLine, logger, string.Empty, TableColumnSeparator, highlightRow, false, StartOfGroupHighlightStrategy,
                                    BoldMarkupFormat, false);
                }

                // Each time we hit the start of a new group, alternative the colour (in the console) or display bold in Markdown
                if (table.FullContentStartOfHighlightGroup[rowCounter])
                {
                    highlightRow = !highlightRow;
                }

                if (ColumnsStartWithSeparator)
                {
                    logger.WriteStatistic(TableColumnSeparator.TrimStart());
                }

                table.PrintLine(line, logger, string.Empty, TableColumnSeparator, highlightRow, table.FullContentStartOfHighlightGroup[rowCounter],
                                StartOfGroupHighlightStrategy, BoldMarkupFormat, EscapeHtml);
                rowCounter++;
            }
        }
 public static void PrintLine(this SummaryTable table, string[] line, ILogger logger, string leftDel = "", string rightDel = "")
 {
     for (int columnIndex = 0; columnIndex < table.ColumnCount; columnIndex++)
         if (table.Columns[columnIndex].NeedToShow)
             logger.WriteStatistic(leftDel + line[columnIndex].PadLeft(table.Columns[columnIndex].Width, ' ') + rightDel);
 }