Add project files.
This commit is contained in:
10
AOC Runner/AOC Runner.csproj
Normal file
10
AOC Runner/AOC Runner.csproj
Normal file
@@ -0,0 +1,10 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net7.0</TargetFramework>
|
||||
<RootNamespace>AOC.Runner</RootNamespace>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
</PropertyGroup>
|
||||
|
||||
</Project>
|
||||
30
AOC Runner/AOCRunner.cs
Normal file
30
AOC Runner/AOCRunner.cs
Normal file
@@ -0,0 +1,30 @@
|
||||
using AOC.Runner;
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace AdventOfCode;
|
||||
public class AOCRunner
|
||||
{
|
||||
public AOCRunner()
|
||||
{
|
||||
FindProblemClasses();
|
||||
}
|
||||
|
||||
private void FindProblemClasses()
|
||||
{
|
||||
|
||||
var types = Assembly.GetExecutingAssembly()?.DefinedTypes.Where(t => t.IsAssignableTo(typeof(IProblemBase)));
|
||||
if (types == null)
|
||||
return;
|
||||
foreach (var type in types)
|
||||
{
|
||||
Console.WriteLine(type.Name);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
18
AOC Runner/IProblemBase.cs
Normal file
18
AOC Runner/IProblemBase.cs
Normal file
@@ -0,0 +1,18 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace AOC.Runner;
|
||||
public interface IProblemBase
|
||||
{
|
||||
void LoadInput();
|
||||
|
||||
void CalculatePart1();
|
||||
|
||||
void PrintPart1();
|
||||
|
||||
void CalculatePart2();
|
||||
void PrintPart2();
|
||||
}
|
||||
13
AOC Runner/ProblemInfoAttribute.cs
Normal file
13
AOC Runner/ProblemInfoAttribute.cs
Normal file
@@ -0,0 +1,13 @@
|
||||
namespace AOC.Runner;
|
||||
public class ProblemInfoAttribute : Attribute
|
||||
{
|
||||
public int Day { get; init; }
|
||||
public string Year { get; init; }
|
||||
public string Name { get; init; }
|
||||
public ProblemInfoAttribute(string year, int day, string name)
|
||||
{
|
||||
Year = year;
|
||||
Day = day;
|
||||
Name = name;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user