mirror of
https://github.com/MCCTeam/Minecraft-Console-Client
synced 2026-08-15 13:04:36 +00:00
Handle TUI startup failures with classic fallback
This commit is contained in:
parent
b757215dbb
commit
157d90273b
3 changed files with 60 additions and 3 deletions
|
|
@ -177,9 +177,16 @@ namespace MinecraftClient
|
|||
if (!ConsoleIO.BasicIO && Config.Console.General.ConsoleMode == ConsoleModeType.tui)
|
||||
{
|
||||
ConsoleIO.Backend?.Shutdown();
|
||||
var tuiBackend = new Tui.TuiConsoleBackend();
|
||||
ConsoleIO.Backend = tuiBackend;
|
||||
tuiBackend.RunTuiMainLoop(args, startupState);
|
||||
try
|
||||
{
|
||||
var tuiBackend = new Tui.TuiConsoleBackend();
|
||||
ConsoleIO.Backend = tuiBackend;
|
||||
tuiBackend.RunTuiMainLoop(args, startupState);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
HandleTuiStartupFailure(ex);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -199,6 +206,20 @@ namespace MinecraftClient
|
|||
RunStartupSequence(args);
|
||||
}
|
||||
|
||||
private static void HandleTuiStartupFailure(Exception exception)
|
||||
{
|
||||
Config.Console.General.ConsoleMode = ConsoleModeType.classic;
|
||||
WriteBackSettings(enableBackup: false);
|
||||
|
||||
ConsoleIO.Backend = new ClassicConsoleBackend();
|
||||
ConsoleIO.Backend.Init();
|
||||
|
||||
ConsoleIO.WriteLineFormatted("§c" + Translations.mcc_tui_startup_failed);
|
||||
ConsoleIO.WriteLine(exception.ToString());
|
||||
ConsoleIO.WriteLineFormatted("§e" + Translations.mcc_report_issue);
|
||||
ConsoleIO.WriteLineFormatted("§e" + Translations.mcc_tui_startup_fallback_classic);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Prints the application banner and processes the startup state collected before
|
||||
/// the console backend was ready. Called once from classic mode or from TUI after
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue