fix installer partly applying color theme before it's selected
This commit is contained in:
parent
dcb3a97727
commit
1b25710cf2
|
@ -8,6 +8,9 @@
|
||||||
-->
|
-->
|
||||||
|
|
||||||
## Upcoming release
|
## Upcoming release
|
||||||
|
* For players:
|
||||||
|
* Fixed Linux/macOS installer's color theme question partly unreadable if the terminal background is dark.
|
||||||
|
|
||||||
* For the web UI:
|
* For the web UI:
|
||||||
* Added log parser warning about performance of PyTK 1.23.0 or earlier.
|
* Added log parser warning about performance of PyTK 1.23.0 or earlier.
|
||||||
|
|
||||||
|
|
|
@ -206,7 +206,7 @@ namespace StardewModdingApi.Installer
|
||||||
Console.WriteLine();
|
Console.WriteLine();
|
||||||
|
|
||||||
// handle choice
|
// handle choice
|
||||||
string choice = this.InteractivelyChoose("Type 1 or 2, then press enter.", new[] { "1", "2" });
|
string choice = this.InteractivelyChoose("Type 1 or 2, then press enter.", new[] { "1", "2" }, printLine: Console.WriteLine);
|
||||||
switch (choice)
|
switch (choice)
|
||||||
{
|
{
|
||||||
case "1":
|
case "1":
|
||||||
|
@ -629,22 +629,22 @@ namespace StardewModdingApi.Installer
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>Interactively ask the user to choose a value.</summary>
|
/// <summary>Interactively ask the user to choose a value.</summary>
|
||||||
/// <param name="print">A callback which prints a message to the console.</param>
|
/// <param name="printLine">A callback which prints a message to the console.</param>
|
||||||
/// <param name="message">The message to print.</param>
|
/// <param name="message">The message to print.</param>
|
||||||
/// <param name="options">The allowed options (not case sensitive).</param>
|
/// <param name="options">The allowed options (not case sensitive).</param>
|
||||||
/// <param name="indent">The indentation to prefix to output.</param>
|
/// <param name="indent">The indentation to prefix to output.</param>
|
||||||
private string InteractivelyChoose(string message, string[] options, string indent = "", Action<string>? print = null)
|
private string InteractivelyChoose(string message, string[] options, string indent = "", Action<string>? printLine = null)
|
||||||
{
|
{
|
||||||
print ??= this.PrintInfo;
|
printLine ??= this.PrintInfo;
|
||||||
|
|
||||||
while (true)
|
while (true)
|
||||||
{
|
{
|
||||||
print(indent + message);
|
printLine(indent + message);
|
||||||
Console.Write(indent);
|
Console.Write(indent);
|
||||||
string? input = Console.ReadLine()?.Trim().ToLowerInvariant();
|
string? input = Console.ReadLine()?.Trim().ToLowerInvariant();
|
||||||
if (input == null || !options.Contains(input))
|
if (input == null || !options.Contains(input))
|
||||||
{
|
{
|
||||||
print($"{indent}That's not a valid option.");
|
printLine($"{indent}That's not a valid option.");
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
return input;
|
return input;
|
||||||
|
|
Loading…
Reference in New Issue