Enable running all days at once

I'm kinda bored and wanted to.
This commit is contained in:
2021-12-12 15:28:41 -06:00
parent 5c37fc4129
commit 9e7942a35e
15 changed files with 845 additions and 848 deletions

View File

@ -1,47 +1,36 @@
using aoc2021;
var arg = args.FirstOrDefault();
switch (arg)
if (arg == "all")
{
case "1":
aoc2021.Day01.Go();
break;
var types = System.Reflection.Assembly
.GetExecutingAssembly()
.GetTypes()
.Where(t => t.IsSubclassOf(typeof(Day)) && !t.IsAbstract && t.Name != "DayTemplate")
.OrderBy(t => t.Name);
case "2":
aoc2021.Day02.Go();
break;
case "3":
aoc2021.Day03.Go();
break;
case "5":
aoc2021.Day05.Go();
break;
case "6":
aoc2021.Day06.Go();
break;
case "7":
aoc2021.Day07.Go();
break;
case "8":
aoc2021.Day08.Go();
break;
case "9":
aoc2021.Day09.Go();
break;
case "10":
aoc2021.Day10.Go();
break;
case "11":
aoc2021.Day11.Go();
break;
default:
aoc2021.Day12.Go();
break;
foreach (var type in types)
{
var day = (Day)Activator.CreateInstance(type)!;
day.Go();
}
}
else
{
Day day = arg switch
{
"1" => new Day01(),
"2" => new Day02(),
"3" => new Day03(),
//"4" => new Day04(),
"5" => new Day05(),
"6" => new Day06(),
"7" => new Day07(),
"8" => new Day08(),
"9" => new Day09(),
"10" => new Day10(),
"11" => new Day11(),
_ => new Day12(),
};
day.Go();
}