Add project files.

This commit is contained in:
2022-11-28 22:54:49 -05:00
parent dd97a677bb
commit c0c9e45e49
20 changed files with 417 additions and 0 deletions

View 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
View 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);
}
}
}

View 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();
}

View 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;
}
}