-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathPrintUtils.cs
51 lines (47 loc) · 1.54 KB
/
PrintUtils.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
namespace MMStatsWatcher;
public static class PrintUtils
{
public static void PrintHeader(string text)
{
int width = Console.BufferWidth;
Console.ForegroundColor = ConsoleColor.Yellow;
Console.WriteLine();
for (int i = 0; i < width; i++)
{
Console.Write('=');
}
Console.Write("=| ");
Console.WriteLine(text);
for (int i = 0; i < width; i++)
{
Console.Write('=');
}
Console.WriteLine();
Console.WriteLine();
}
public static void PrintGeoTypeStat(IEnumerable<Entry> data, int t, string name)
{
var f = data.Where(x => x.gt == t).ToArray();
Console.ForegroundColor = ConsoleColor.White;
Console.Write("Geopoint type ");
Console.ForegroundColor = ConsoleColor.Green;
Console.Write($"\"{name}\"");
Console.ForegroundColor = ConsoleColor.White;
Console.Write(" was used ");
Console.ForegroundColor = ConsoleColor.Cyan;
Console.Write(f.Length);
Console.ForegroundColor = ConsoleColor.White;
Console.Write(" times.");
var max = f.GroupBy(x => x.device).MaxBy(x => x.Count());
if (max != null)
{
Console.Write(" Most used device: ");
Console.ForegroundColor = ConsoleColor.Green;
Console.Write(max.Key);
Console.ForegroundColor = ConsoleColor.White;
Console.WriteLine($", {max.Count()} times.");
}
else
Console.WriteLine();
}
}