diff --git a/AOC2022/Program.cs b/AOC2022/Program.cs index c8da6f6..a876ddb 100644 --- a/AOC2022/Program.cs +++ b/AOC2022/Program.cs @@ -58,9 +58,10 @@ internal static class Program string instanceToCreate = "AOC2022.Puzzles.Day" + day; Type? typeName = Type.GetType(typeName: instanceToCreate); + var linesInFile = File.ReadAllLines($"Inputs/{day}.txt"); if (typeName != null) { - if (Activator.CreateInstance(typeName) is IPuzzle puzzle) + if (Activator.CreateInstance(typeName, new object[] { linesInFile }) is IPuzzle puzzle) { puzzle.FirstPuzzle(); puzzle.SecondPuzzle(); diff --git a/AOC2022/Puzzles/Day1.cs b/AOC2022/Puzzles/Day1.cs index 3ee9ea3..4a9f641 100644 --- a/AOC2022/Puzzles/Day1.cs +++ b/AOC2022/Puzzles/Day1.cs @@ -8,9 +8,19 @@ namespace AOC2022.Puzzles; internal class Day1 : IPuzzle { + private readonly string[] linesFromFile; + + public Day1(string[] linesFromFile) + { + this.linesFromFile = linesFromFile; + } + public void FirstPuzzle() { - throw new NotImplementedException(); + foreach (var line in linesFromFile) + { + Console.WriteLine(line); + } } public void SecondPuzzle()