summaryrefslogtreecommitdiff
path: root/RegionVisualiser/BoxDrawer.cs
diff options
context:
space:
mode:
authorMelodi <62381002+Melodi17@users.noreply.github.com>2026-03-17 20:49:22 +1000
committerMelodi <62381002+Melodi17@users.noreply.github.com>2026-03-17 20:49:22 +1000
commit18868128e18d38b706e7df14e8e683e1a9739c17 (patch)
tree6f0e0e5eee646f10cbad9c0c89c24d330bc58cc6 /RegionVisualiser/BoxDrawer.cs
parentd87ab8af4c86a3fc6ee237444e372d87e536e3ef (diff)
chore: Initial commit
Diffstat (limited to 'RegionVisualiser/BoxDrawer.cs')
-rw-r--r--RegionVisualiser/BoxDrawer.cs49
1 files changed, 0 insertions, 49 deletions
diff --git a/RegionVisualiser/BoxDrawer.cs b/RegionVisualiser/BoxDrawer.cs
deleted file mode 100644
index 77d0fc7..0000000
--- a/RegionVisualiser/BoxDrawer.cs
+++ /dev/null
@@ -1,49 +0,0 @@
-namespace RegionVisualiser;
-
-public static class BoxDrawer
-{
- public static void DrawBox(string title, string body, int width = 0, string head = "", string tail = "")
- {
- int leftPad = Math.Max(head.Length, tail.Length);
- var lines = body.Split('\n');
- int maxWidth = Math.Max(Math.Max(title.Length + 2, BoxDrawer.GetMaxWidth(lines) + 1), width);
-
- // Top border with centered title
- string top = "┌" + BoxDrawer.CenterText($" {title} ", maxWidth, '─') + "┐";
- Console.Write(head);
- Console.CursorLeft = leftPad;
- Console.WriteLine(top);
-
- // Body lines, left aligned
- foreach (var line in lines)
- {
- Console.CursorLeft = leftPad;
- Console.WriteLine("│ " + line.PadRight(maxWidth - 1) + "│");
- }
-
- // Bottom border
- string bottom = "└" + new string('─', maxWidth) + "┘";
- Console.Write(tail);
- Console.CursorLeft = leftPad;
- Console.WriteLine(bottom);
- }
-
- private static int GetMaxWidth(string[] lines)
- {
- int width = 0;
- foreach (var l in lines)
- if (l.Length + 1 > width) width = l.Length + 1;
- return width;
- }
-
- private static string CenterText(string text, int width, char fill)
- {
- int totalPad = width - text.Length;
- if (totalPad <= 0) return text;
-
- int left = totalPad / 2;
- int right = totalPad - left;
-
- return new string(fill, left) + text + new string(fill, right);
- }
-} \ No newline at end of file