update runner to set date

This commit is contained in:
2023-12-04 18:19:26 -05:00
parent 9845727fc5
commit 4686a6709c

View File

@@ -37,6 +37,24 @@ public class AOCRunner
}
}
public AOCRunner WithDay(int day)
{
var problem = _loadedProblems[_selectedYear].FirstOrDefault(d => d.info.Day == day);
if (problem == default)
throw new ArgumentException($"The no problems have been loaded for the day '{day}' of year '{_selectedYear}'", nameof(day));
_selectedDay = _loadedProblems[_selectedYear].IndexOf(problem);
return this;
}
public AOCRunner WithYear(int year)
{
if (!_loadedProblems.ContainsKey(year))
throw new ArgumentException($"The no problems have been loaded for the year '{year}'", nameof(year));
_selectedYear = year;
return this;
}
private void InitSizing()
{
_maxProblemCount = Console.WindowHeight - 9;