From 18868128e18d38b706e7df14e8e683e1a9739c17 Mon Sep 17 00:00:00 2001 From: Melodi <62381002+Melodi17@users.noreply.github.com> Date: Tue, 17 Mar 2026 20:49:22 +1000 Subject: chore: Initial commit --- RegionVisualiser/SizeFormatter.cs | 25 ------------------------- 1 file changed, 25 deletions(-) delete mode 100644 RegionVisualiser/SizeFormatter.cs (limited to 'RegionVisualiser/SizeFormatter.cs') diff --git a/RegionVisualiser/SizeFormatter.cs b/RegionVisualiser/SizeFormatter.cs deleted file mode 100644 index 3479bd8..0000000 --- a/RegionVisualiser/SizeFormatter.cs +++ /dev/null @@ -1,25 +0,0 @@ -namespace RegionVisualiser; - -public static class SizeFormatter -{ - private static readonly string[] Units = ["bytes", "KB", "MB", "GB", "TB"]; - - public static string HumanReadable(long bytes) - { - if (bytes < 1024) return $"{bytes} {SizeFormatter.Units[0]}"; - - double value = bytes; - int unit = 0; - - while (value >= 1024 && unit < SizeFormatter.Units.Length - 1) - { - value /= 1024; - unit++; - } - - // Show up to 2 decimal places if not whole - return value % 1 == 0 - ? $"{value:0} {SizeFormatter.Units[unit]}" - : $"{value:0.##} {SizeFormatter.Units[unit]}"; - } -} \ No newline at end of file -- cgit v1.3.1