예제 #1
0
    protected static string GetInputForDay(DayBase day)
    {
        var dayNumber    = Convert.ToInt32(day.GetType().Name.Replace("Day", ""));
        var fileName     = $"Day{dayNumber:00}Input.txt";
        var assembly     = Assembly.GetExecutingAssembly();
        var moduleName   = Regex.Replace(assembly.ManifestModule.Name, @"\.(exe|dll)$", string.Empty, RegexOptions.IgnoreCase);
        var resourceName = $"{moduleName}.{fileName}";

        using var stream = assembly.GetManifestResourceStream(resourceName);
        using var reader = new StreamReader(stream ?? throw new InvalidOperationException($"Could not read file {fileName}"));
        return(reader.ReadToEnd());
    }
예제 #2
0
 public DayRunner(DayBase day)
 {
     _day = day;
 }