fix(console): route data-gating and first-boot prompts through headless-aware ReadLine

Data-gating prompts (delete corrupt entities/files) and first-boot config
prompts (data dir, listeners, server name, expansion, maps) now call
ConsoleInputHandler.ReadLine() instead of Console.ReadLine() directly, so a
headless server crashes fatal with a clear message instead of reading null.
This commit is contained in:
Kamron Batman 2026-07-15 22:01:19 -07:00
parent cd62856767
commit 45ea449419
4 changed files with 8 additions and 8 deletions

View file

@ -23,7 +23,7 @@ public static class ExpansionConfigurationPrompts
do
{
Console.Write("[enter for {0}]> ", maxExpansionName);
var input = Console.ReadLine();
var input = ConsoleInputHandler.ReadLine();
Expansion expansion;
if (string.IsNullOrWhiteSpace(input))
@ -77,7 +77,7 @@ public static class ExpansionConfigurationPrompts
do
{
OutputSelectedMaps(expansion, selectedMaps);
lastInput = Console.ReadLine()?.TrimEnd();
lastInput = ConsoleInputHandler.ReadLine()?.TrimEnd();
if (string.IsNullOrWhiteSpace(lastInput))
{

View file

@ -16,7 +16,7 @@ public static class ServerConfigurationPrompts
do
{
Console.Write("{0}> ", directories.Count > 0 ? "[enter to finish]" : " ");
var directory = Console.ReadLine();
var directory = ConsoleInputHandler.ReadLine();
if (string.IsNullOrWhiteSpace(directory))
{
break;
@ -55,7 +55,7 @@ public static class ServerConfigurationPrompts
{
// IP:Port?
Console.Write("[{0}]> ", ips.Count > 0 ? "enter to finish" : "0.0.0.0:2593");
var ipStr = Console.ReadLine();
var ipStr = ConsoleInputHandler.ReadLine();
IPEndPoint ip;
if (string.IsNullOrWhiteSpace(ipStr))
@ -102,7 +102,7 @@ public static class ServerConfigurationPrompts
do
{
Console.Write("[ModernUO]> ");
serverName = Console.ReadLine();
serverName = ConsoleInputHandler.ReadLine();
if (string.IsNullOrWhiteSpace(serverName))
{

View file

@ -166,7 +166,7 @@ public class GenericEntityPersistence<T> : GenericPersistence, IGenericEntityPer
Console.Write($"Error: Type '{typeName}' was {issue}. Delete all of those types? (y/n): ");
if (Console.ReadLine().InsensitiveEquals("y"))
if (ConsoleInputHandler.ReadLine().InsensitiveEquals("y"))
{
Console.WriteLine("Loading...");
return null;
@ -430,7 +430,7 @@ public class GenericEntityPersistence<T> : GenericPersistence, IGenericEntityPer
if (!deleteAllFailures)
{
Console.Write("Delete the object and continue? (y/n/a): ");
var pressedKey = Console.ReadLine();
var pressedKey = ConsoleInputHandler.ReadLine();
if (pressedKey.InsensitiveEquals("a"))
{

View file

@ -104,7 +104,7 @@ public abstract class GenericPersistence : Persistence, IGenericSerializable
Console.WriteLine(error);
Console.Write("Skip this file and continue? (y/n): ");
var y = Console.ReadLine();
var y = ConsoleInputHandler.ReadLine();
if (!y.InsensitiveEquals("y"))
{