Ver código fonte

Project template for dotnet new

Lukas Angerer 2 anos atrás
pai
commit
0e5b048b69

+ 13 - 0
DayTemplate/.template.config/template.json

@@ -0,0 +1,13 @@
+{
+  "$schema": "http://json.schemastore.org/template",
+  "author": "LAR",
+  "classifications": [ "Common", "Console" ],
+  "identity": "AdventOfCode.DayTemplate",
+  "name": "AdventOfCode 2023 project template",
+  "shortName": "aoc",
+  "sourceName":"DayTemplate",
+  "tags": {
+    "language": "C#",
+    "type": "project"
+  }
+}

+ 10 - 0
DayTemplate/DayTemplate.csproj

@@ -0,0 +1,10 @@
+<Project Sdk="Microsoft.NET.Sdk">
+
+  <PropertyGroup>
+    <OutputType>Exe</OutputType>
+    <TargetFramework>net8.0</TargetFramework>
+    <ImplicitUsings>enable</ImplicitUsings>
+    <Nullable>enable</Nullable>
+  </PropertyGroup>
+
+</Project>

+ 19 - 0
DayTemplate/Parser.cs

@@ -0,0 +1,19 @@
+using System.Text.RegularExpressions;
+
+namespace DayTemplate;
+
+public partial class Parser
+{
+    [GeneratedRegex(@".*")]
+    private partial Regex LineMatch();
+    
+    public void Parse(string inputFile)
+    {
+        using var reader = File.OpenText(inputFile);
+        
+        while (!reader.EndOfStream)
+        {
+            var line = reader.ReadLine()!;
+        }
+    }
+}

+ 20 - 0
DayTemplate/Program.cs

@@ -0,0 +1,20 @@
+using System.Diagnostics;
+
+using DayTemplate;
+
+if (args.Any(a => a == "--debug"))
+{
+    Console.WriteLine("DEBUG");
+    Console.WriteLine(Debugger.Launch());
+}
+
+if (args.Length < 1)
+{
+    Console.WriteLine("Requires 1 args: inputFileName");
+    return -1;
+}
+
+var inputFile = args[0];
+var parser = new Parser();
+
+return 0;

+ 0 - 0
DayTemplate/inputs/sample1.txt


+ 9 - 0
README.md

@@ -0,0 +1,9 @@
+Install the template
+```
+dotnet new install [--force] .\DayTemplate\
+```
+
+Create a new day (from the project root)
+```
+dotnet new aoc -o Day9
+```