From 39b86c8e4d523da42a3d3d5aadcac531914ea06e Mon Sep 17 00:00:00 2001 From: Aptivi Date: Sun, 10 Mar 2024 13:53:43 +0300 Subject: [PATCH] chg - Do it for the remaining occurrences --- Type: chg Breaking: False Doc Required: False Part: 1/1 --- GRILO.Bootloader/Boot/Style/Styles/GrubBootStyle.cs | 12 ++++++------ .../Boot/Style/Styles/GrubLegacyBootStyle.cs | 12 ++++++------ GRILO.Bootloader/Boot/Style/Styles/LiloBootStyle.cs | 10 +++++----- 3 files changed, 17 insertions(+), 17 deletions(-) diff --git a/GRILO.Bootloader/Boot/Style/Styles/GrubBootStyle.cs b/GRILO.Bootloader/Boot/Style/Styles/GrubBootStyle.cs index 556ce07..74d1b62 100644 --- a/GRILO.Bootloader/Boot/Style/Styles/GrubBootStyle.cs +++ b/GRILO.Bootloader/Boot/Style/Styles/GrubBootStyle.cs @@ -50,7 +50,7 @@ public override string Render() // Now, render a box builder.Append( - BorderColor.RenderBorder(2, 4, ConsoleWrapper.WindowWidth - 6, Console.WindowHeight - 15, new Color(boxBorderColor)) + BorderColor.RenderBorder(2, 4, ConsoleWrapper.WindowWidth - 6, ConsoleWrapper.WindowHeight - 15, new Color(boxBorderColor)) ); // Offer help for new users @@ -60,7 +60,7 @@ public override string Render() $"before booting or `c' for a command line."; int longest = help.Split(['\n']).Max((text) => text.Length); builder.Append( - TextWriterWhereColor.RenderWhereColor(help, Console.WindowWidth / 2 - longest / 2 - 2, Console.WindowHeight - 8, new Color(sectionTitle)) + TextWriterWhereColor.RenderWhereColor(help, ConsoleWrapper.WindowWidth / 2 - longest / 2 - 2, ConsoleWrapper.WindowHeight - 8, new Color(sectionTitle)) ); return builder.ToString(); } @@ -75,7 +75,7 @@ public override string RenderHighlight(int chosenBootEntry) // Populate boot entries inside the box var bootApps = BootManager.GetBootApps(); (int, int) upperLeftCornerInterior = (3, 5); - (int, int) lowerLeftCornerInterior = (3, Console.WindowHeight - 9); + (int, int) lowerLeftCornerInterior = (3, ConsoleWrapper.WindowHeight - 9); int maxItemsPerPage = lowerLeftCornerInterior.Item2 - upperLeftCornerInterior.Item2 - 1; int currentPage = (int)Math.Truncate(chosenBootEntry / (double)maxItemsPerPage); int startIndex = maxItemsPerPage * currentPage; @@ -90,7 +90,7 @@ public override string RenderHighlight(int chosenBootEntry) var finalColorBg = i == chosenBootEntry ? highlightedEntry : normalEntry; var finalColorFg = i == chosenBootEntry ? normalEntry : highlightedEntry; builder.Append( - TextWriterWhereColor.RenderWhereColorBack(rendered + new string(' ', Console.WindowWidth - 6 - rendered.Length), upperLeftCornerInterior.Item1, upperLeftCornerInterior.Item2 + renderedAnswers, false, new Color(finalColorFg), new Color(finalColorBg)) + TextWriterWhereColor.RenderWhereColorBack(rendered + new string(' ', ConsoleWrapper.WindowWidth - 6 - rendered.Length), upperLeftCornerInterior.Item1, upperLeftCornerInterior.Item2 + renderedAnswers, false, new Color(finalColorFg), new Color(finalColorBg)) ); renderedAnswers++; } @@ -103,13 +103,13 @@ public override string RenderBootFailedMessage(string content) => public override string RenderSelectTimeout(int timeout) { string help = $"The highlighted entry will be executed automatically in {timeout}s. "; - return TextWriterWhereColor.RenderWhereColor(help, 4, Console.WindowHeight - 5, true, new Color(ConsoleColor.White)); + return TextWriterWhereColor.RenderWhereColor(help, 4, ConsoleWrapper.WindowHeight - 5, true, new Color(ConsoleColor.White)); } public override string ClearSelectTimeout() { string help = $"The highlighted entry will be executed automatically in {Config.Instance.BootSelectTimeoutSeconds}s. "; - return TextWriterWhereColor.RenderWhereColor(new string(' ', help.Length), 4, Console.WindowHeight - 5, true, new Color(ConsoleColor.White)); + return TextWriterWhereColor.RenderWhereColor(new string(' ', help.Length), 4, ConsoleWrapper.WindowHeight - 5, true, new Color(ConsoleColor.White)); } } } diff --git a/GRILO.Bootloader/Boot/Style/Styles/GrubLegacyBootStyle.cs b/GRILO.Bootloader/Boot/Style/Styles/GrubLegacyBootStyle.cs index 42c6631..afe2e28 100644 --- a/GRILO.Bootloader/Boot/Style/Styles/GrubLegacyBootStyle.cs +++ b/GRILO.Bootloader/Boot/Style/Styles/GrubLegacyBootStyle.cs @@ -50,7 +50,7 @@ public override string Render() // Now, render a box builder.Append( - BorderColor.RenderBorder(2, 4, ConsoleWrapper.WindowWidth - 6, Console.WindowHeight - 15, new Color(boxBorderColor)) + BorderColor.RenderBorder(2, 4, ConsoleWrapper.WindowWidth - 6, ConsoleWrapper.WindowHeight - 15, new Color(boxBorderColor)) ); // Offer help for new users @@ -60,7 +60,7 @@ public override string Render() $"commands before booting or `c' for a command line."; int longest = help.Split(['\n']).Max((text) => text.Length); builder.Append( - TextWriterWhereColor.RenderWhereColor(help, Console.WindowWidth / 2 - longest / 2 - 2, Console.WindowHeight - 8, new Color(sectionTitle)) + TextWriterWhereColor.RenderWhereColor(help, ConsoleWrapper.WindowWidth / 2 - longest / 2 - 2, ConsoleWrapper.WindowHeight - 8, new Color(sectionTitle)) ); return builder.ToString(); } @@ -75,7 +75,7 @@ public override string RenderHighlight(int chosenBootEntry) // Populate boot entries inside the box var bootApps = BootManager.GetBootApps(); (int, int) upperLeftCornerInterior = (3, 5); - (int, int) lowerLeftCornerInterior = (3, Console.WindowHeight - 9); + (int, int) lowerLeftCornerInterior = (3, ConsoleWrapper.WindowHeight - 9); int maxItemsPerPage = lowerLeftCornerInterior.Item2 - upperLeftCornerInterior.Item2 - 1; int currentPage = (int)Math.Truncate(chosenBootEntry / (double)maxItemsPerPage); int startIndex = maxItemsPerPage * currentPage; @@ -90,7 +90,7 @@ public override string RenderHighlight(int chosenBootEntry) var finalColorBg = i == chosenBootEntry ? highlightedEntry : normalEntry; var finalColorFg = i == chosenBootEntry ? normalEntry : highlightedEntry; builder.Append( - TextWriterWhereColor.RenderWhereColorBack(rendered + new string(' ', Console.WindowWidth - 6 - rendered.Length), upperLeftCornerInterior.Item1, upperLeftCornerInterior.Item2 + renderedAnswers, false, new Color(finalColorFg), new Color(finalColorBg)) + TextWriterWhereColor.RenderWhereColorBack(rendered + new string(' ', ConsoleWrapper.WindowWidth - 6 - rendered.Length), upperLeftCornerInterior.Item1, upperLeftCornerInterior.Item2 + renderedAnswers, false, new Color(finalColorFg), new Color(finalColorBg)) ); renderedAnswers++; } @@ -110,13 +110,13 @@ public override string RenderBootFailedMessage(string content) => public override string RenderSelectTimeout(int timeout) { string help = $"The highlighted entry will be executed automatically in {timeout}s. "; - return TextWriterWhereColor.RenderWhereColor(help, 4, Console.WindowHeight - 5, true, new Color(ConsoleColor.White)); + return TextWriterWhereColor.RenderWhereColor(help, 4, ConsoleWrapper.WindowHeight - 5, true, new Color(ConsoleColor.White)); } public override string ClearSelectTimeout() { string help = $"The highlighted entry will be executed automatically in {Config.Instance.BootSelectTimeoutSeconds}s. "; - return TextWriterWhereColor.RenderWhereColor(new string(' ', help.Length), 4, Console.WindowHeight - 5, true, new Color(ConsoleColor.White)); + return TextWriterWhereColor.RenderWhereColor(new string(' ', help.Length), 4, ConsoleWrapper.WindowHeight - 5, true, new Color(ConsoleColor.White)); } } } diff --git a/GRILO.Bootloader/Boot/Style/Styles/LiloBootStyle.cs b/GRILO.Bootloader/Boot/Style/Styles/LiloBootStyle.cs index 40e91c5..cedadfe 100644 --- a/GRILO.Bootloader/Boot/Style/Styles/LiloBootStyle.cs +++ b/GRILO.Bootloader/Boot/Style/Styles/LiloBootStyle.cs @@ -48,7 +48,7 @@ public override string Render() int bootPrompt = 16; int halfX = ConsoleWrapper.WindowWidth / 2 - (interiorWidth + 2) / 2; int extraStartX = ConsoleWrapper.WindowWidth / 2 - (interiorWidth + 4) / 2; - int extraEndX = Console.WindowWidth / 2 + (interiorWidth + 4) / 2; + int extraEndX = ConsoleWrapper.WindowWidth / 2 + (interiorWidth + 4) / 2; int startY = 1; int endY = bootPrompt + startY - 2; builder.Append( @@ -70,7 +70,7 @@ public override string Render() // Now, fill the box with usual things, starting from the title string title = "LILO 22.7 Boot Menu"; - int titleX = Console.WindowWidth / 2 - title.Length / 2; + int titleX = ConsoleWrapper.WindowWidth / 2 - title.Length / 2; int titleY = 3; builder.Append( TextWriterWhereColor.RenderWhereColorBack(title, titleX, titleY, new Color(sectionTitle), new Color(boxBorderBackgroundColor)) @@ -123,7 +123,7 @@ public override string RenderHighlight(int chosenBootEntry) var builder = new StringBuilder(); var bootApps = BootManager.GetBootApps(); int interiorWidth = 41; - int halfX = Console.WindowWidth / 2 - (interiorWidth + 2) / 2 + 4; + int halfX = ConsoleWrapper.WindowWidth / 2 - (interiorWidth + 2) / 2 + 4; (int, int) upperLeftCornerInterior = (halfX, 6); int maxItemsPerPage = 4; int currentPage = (int)Math.Truncate(chosenBootEntry / (double)maxItemsPerPage); @@ -155,7 +155,7 @@ public override string RenderSelectTimeout(int timeout) string help = $"{TimeSpan.FromSeconds(timeout):mm}:{TimeSpan.FromSeconds(timeout):ss}"; int textY = 11; int interiorWidth = 41; - int extraEndX = Console.WindowWidth / 2 + interiorWidth / 2 - help.Length; + int extraEndX = ConsoleWrapper.WindowWidth / 2 + interiorWidth / 2 - help.Length; return TextWriterWhereColor.RenderWhereColorBack(help, extraEndX, textY, true, new Color(ConsoleColor.Gray), new Color(ConsoleColor.DarkRed)); } @@ -164,7 +164,7 @@ public override string ClearSelectTimeout() string help = $"{TimeSpan.FromSeconds(Config.Instance.BootSelectTimeoutSeconds):mm}:{TimeSpan.FromSeconds(Config.Instance.BootSelectTimeoutSeconds):ss}"; int textY = 11; int interiorWidth = 41; - int extraEndX = Console.WindowWidth / 2 + interiorWidth / 2 - help.Length; + int extraEndX = ConsoleWrapper.WindowWidth / 2 + interiorWidth / 2 - help.Length; return TextWriterWhereColor.RenderWhereColorBack(new string(' ', help.Length), extraEndX, textY, true, new Color(ConsoleColor.Gray), new Color(ConsoleColor.DarkRed)); } }