Add benchmark support using -b
This commit is contained in:
14
Days/Day7.cs
14
Days/Day7.cs
@@ -32,7 +32,7 @@ public class Day7 : Day
|
||||
{
|
||||
public override int Number => 7;
|
||||
public override string Name => "No Space Left On Device";
|
||||
public override void RunPart1()
|
||||
public override void RunPart1(bool display = true)
|
||||
{
|
||||
var fileSystem = ParseFileSystem();
|
||||
|
||||
@@ -42,10 +42,13 @@ public class Day7 : Day
|
||||
.Where(d => d.Size < 100_000)
|
||||
.Sum(d => d.Size);
|
||||
|
||||
AnsiConsole.MarkupLine($"[green]Total size: [yellow]{totalSize}[/][/]");
|
||||
if (display)
|
||||
{
|
||||
AnsiConsole.MarkupLine($"[green]Total size: [yellow]{totalSize}[/][/]");
|
||||
}
|
||||
}
|
||||
|
||||
public override void RunPart2()
|
||||
public override void RunPart2(bool display = true)
|
||||
{
|
||||
const long fileSystemSpace = 70_000_000;
|
||||
const long requiredSpace = 30_000_000;
|
||||
@@ -63,7 +66,10 @@ public class Day7 : Day
|
||||
.Where(d => d.Size > missingSpace)
|
||||
.MinBy(d => d.Size);
|
||||
|
||||
AnsiConsole.MarkupLine($"[green]Directory to remove size: [yellow]{directoryToRemove!.Size}[/][/]");
|
||||
if (display)
|
||||
{
|
||||
AnsiConsole.MarkupLine($"[green]Directory to remove size: [yellow]{directoryToRemove!.Size}[/][/]");
|
||||
}
|
||||
}
|
||||
|
||||
private static DirectoryEntry ParseFileSystem()
|
||||
|
||||
Reference in New Issue
Block a user