public void Print(BenchmarkCaseGroup group, BenchmarkCaseGroupResult result)
        {
            Console.ForegroundColor = ConsoleColor.Green;
            Console.WriteLine(group.Info);
            Console.ResetColor();
            Console.WriteLine();

            foreach (var cs in result.Cases)
            {
                Console.WriteLine("Items {0}", cs.Key);

                var table = new ConsoleTables.ConsoleTable(
                    "Logger",
                    "Total(ms)",
                    "Create(ms)",
                    "Write(ms)",
                    "Dispose(ms)"
                    );

                table.Options.EnableCount = false;

                foreach (var bc in cs.Value)
                {
                    table.AddRow(
                        $"{bc.LoggerInfo}",
                        $"{bc.BenchmarkResult.TotalTimeMs}",
                        $"{bc.BenchmarkResult.CreateTimeMs}",
                        $"{bc.BenchmarkResult.WriteTimeMs}",
                        $"{bc.BenchmarkResult.DisposeTimeMs}"
                        );
                }

                table.Write();
            }

            var resultTable = new ConsoleTables.ConsoleTable("Logger", "Rank");

            resultTable.Options.EnableCount = false;

            foreach (var place in result.Ranks)
            {
                resultTable.AddRow($"{place.Key}", $"{place.Value}");
            }

            Console.ForegroundColor = ConsoleColor.Yellow;
            Console.WriteLine("Results:");
            Console.ResetColor();

            resultTable.Write(Format.Alternative);

            Console.WriteLine(new string('#', 50));
            Console.WriteLine();
        }
Ejemplo n.º 2
0
        public void PrintTable()
        {
            List <string> columns = new List <string>
            {
                "Visual Skin"
            };

            columns.Add("");

            ConsoleTable table = new ConsoleTables.ConsoleTable(new ConsoleTableOptions
            {
                Columns     = columns,
                EnableCount = false
            });

            var maxVariation = Variations.Keys.Last();

            int variationValidMax = int.MaxValue;

            for (int v = 0; v <= maxVariation; v++)
            {
                List <string> row = new List <string>();
                row.Add("V" + v);

                if (Variations.ContainsKey(v))
                {
                    table.SetColor(1, v, (v >= variationValidMax) ? ConsoleColor.Red : ConsoleColor.Green);
                    row.Add("ok");
                }
                else
                {
                    if (v < variationValidMax)
                    {
                        variationValidMax = v;
                    }

                    table.SetColor(1, v, ConsoleColor.Red);
                    row.Add("--");
                }
                table.AddRow(row.ToArray());
            }

            table.Write(Program.ConsoleTableFormat);
        }
Ejemplo n.º 3
0
        private static void UpdateConsole()
        {
            while (true)
            {
                Console.Clear();
                var    Uptime = DateTime.Now - Startup;
                string msg    = $"Startup Time: {Startup.ToString()}";
                msg += Environment.NewLine + $"Uptime: {Uptime.ToString()}";
                var games     = Program.Games;
                int gameCount = games.Count();

                msg += Environment.NewLine + $"Number of Games: {gameCount.ToString()}";
                Console.WriteLine(msg);

                var table = new ConsoleTables.ConsoleTable("Game GUID", "ChatId", "Phase", "Round", "# of Players");
                foreach (SixNimmt game in games.ToArray())
                {
                    if (game.Phase == SixNimmt.GamePhase.KillGame)
                    {
                        Bot.RemoveGame(game);
                        continue;
                    }
                    try
                    {
                        table.AddRow(game.Id.ToString(), game.ChatId.ToString(), game.Phase.ToString(),
                                     game.Round, game.Players.Count().ToString());
                    }
                    catch
                    {
                        // no game?
                    }
                }
                table.Write(ConsoleTables.Format.Alternative);

                Thread.Sleep(2000);
            }
        }
Ejemplo n.º 4
0
        public void PrintTable()
        {
            int columnsCount = ColorsCount;

            if (columnsCount == 0)
            {
                return;
            }

            List <string> columns = new List <string>();

            columns.Add("V\\C");
            for (int i = 0; i < columnsCount; i++)
            {
                columns.Add("C" + i);
            }

            ConsoleTable table = new ConsoleTables.ConsoleTable(new ConsoleTableOptions
            {
                Columns     = columns,
                EnableCount = false,
            });

            int variationValidMax = int.MaxValue;
            int colorValidMax     = int.MaxValue;

            var maxVariationIndexGlobal = Variations.Keys.Max(t => t.V);

            for (int v = 0; v <= maxVariationIndexGlobal; v++)
            {
                List <string> row = new List <string>();
                row.Add("V" + v);

                for (int c = 0; c < columnsCount; c++)
                {
                    if (Variations.ContainsKey(new VarIDColID(v, c)))
                    {
                        table.SetColor(c + 1, v, (v >= variationValidMax && c >= colorValidMax) ? ConsoleColor.Red : ConsoleColor.Green);
                        row.Add("ok");
                    }
                    else
                    {
                        if (c < colorValidMax)
                        {
                            colorValidMax = c;
                        }

                        if (v < variationValidMax)
                        {
                            variationValidMax = v;
                        }

                        table.SetColor(c + 1, v, ConsoleColor.Red);
                        row.Add("--");
                    }
                }
                table.AddRow(row.ToArray());
            }

            table.Write(Program.ConsoleTableFormat);
        }