added constructor params
parent
754cf5f4b9
commit
74fa2da997
|
@ -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();
|
||||
|
|
|
@ -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()
|
||||
|
|
Loading…
Reference in New Issue