public static void Main() { // User input var directoryOfJsonFiles = "C:\\Users\\fredrik\\Documents\\playing_with_projections\\data"; List <string> jsonFiles = Directory.EnumerateFiles(directoryOfJsonFiles).Where(x => x.Contains(".json")).ToList(); ConsoleTools.WriteColor($"Found {jsonFiles.Count()} files:", ConsoleColor.Green); foreach (string file in jsonFiles) { int index = jsonFiles.IndexOf(file); ConsoleTools.WriteColor($"{index}. {file}", ConsoleColor.Gray); } ConsoleTools.WriteColor($"{jsonFiles.Count()}. All files", ConsoleColor.Gray); Console.WriteLine("Please choose a file (by number)"); string inp = Console.ReadLine(); int selection = int.Parse(inp); string[] selectedFile; if (selection == jsonFiles.Count()) { selectedFile = new string[] { directoryOfJsonFiles } } ; else { selectedFile = new string[] { jsonFiles[selection] } }; ConsoleTools.WriteColor("\nAvailable projections are:", ConsoleColor.Green); int pIndex = 0; ConsoleTools.WriteColor($"{pIndex}. Count", ConsoleColor.Gray); pIndex++; ConsoleTools.WriteColor($"{pIndex}. HowManyPlayersHaveRegistered", ConsoleColor.Gray); pIndex++; ConsoleTools.WriteColor($"{pIndex}. HowManyPlayersHaveRegisteredEachMonth", ConsoleColor.Gray); pIndex++; ConsoleTools.WriteColor($"{pIndex}. TrendingGames", ConsoleColor.Gray); pIndex++; ConsoleTools.WriteColor($"{pIndex}. ActivePlayers", ConsoleColor.Gray); pIndex++; Console.WriteLine("Please choose a projection (by number)"); int selectedProjection = int.Parse(Console.ReadLine()); var events = GetEvents(selectedFile); // Actions if (selectedProjection == 0) { Console.WriteLine("Number of events: {0}", EventCounter.Count(events)); } if (selectedProjection == 1) { Console.WriteLine("Players registered: {0}", EventCounter.HowManyPlayersHaveRegistered(events)); } if (selectedProjection == 2) { Dictionary <string, int> dict = EventCounter.HowManyPlayersHaveRegisteredEachMonth(events); Console.WriteLine($"Month \t\t Number"); foreach (KeyValuePair <string, int> kvp in dict) { Console.WriteLine($"{kvp.Key, 0} {kvp.Value, 20}"); } } if (selectedProjection == 3) { IOrderedEnumerable <KeyValuePair <string, int> > dict = EventCounter.TrendingGames(events); Console.WriteLine($"Game ID \t\t Plays"); foreach (KeyValuePair <string, int> kvp in dict) { Console.WriteLine($"{kvp.Key,0} {kvp.Value,20}"); } } if (selectedProjection == 4) { List <string> activePlayerList = EventCounter.ActivePlayers(events); Console.WriteLine("Currently Active players"); activePlayerList.ForEach(x => Console.WriteLine(x)); } Console.ReadKey(); }