Skip to content
This repository has been archived by the owner on Jun 3, 2024. It is now read-only.

Commit

Permalink
chg - Do it for the remaining occurrences
Browse files Browse the repository at this point in the history
---

Type: chg
Breaking: False
Doc Required: False
Part: 1/1
  • Loading branch information
AptiviCEO committed Mar 10, 2024
1 parent c4f20d2 commit 39b86c8
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 17 deletions.
12 changes: 6 additions & 6 deletions GRILO.Bootloader/Boot/Style/Styles/GrubBootStyle.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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();
}
Expand All @@ -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;
Expand All @@ -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++;
}
Expand All @@ -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));
}
}
}
12 changes: 6 additions & 6 deletions GRILO.Bootloader/Boot/Style/Styles/GrubLegacyBootStyle.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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();
}
Expand All @@ -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;
Expand All @@ -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++;
}
Expand All @@ -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));
}
}
}
10 changes: 5 additions & 5 deletions GRILO.Bootloader/Boot/Style/Styles/LiloBootStyle.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand All @@ -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))
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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));
}

Expand All @@ -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));
}
}
Expand Down

0 comments on commit 39b86c8

Please sign in to comment.