mirror of
https://github.com/MCCTeam/Minecraft-Console-Client
synced 2026-08-15 13:04:36 +00:00
Refactor ConsoleIO and Program settings handling
- Updated ConsoleIO to allow writing to the console when Backend is null, improving error handling. - Simplified settings write-back logic in Program.cs to ensure default settings are written correctly based on configuration results.
This commit is contained in:
parent
f0fda8ce9f
commit
9cada9d19d
2 changed files with 6 additions and 9 deletions
|
|
@ -104,7 +104,7 @@ namespace MinecraftClient
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public static void WriteLine(string line)
|
public static void WriteLine(string line)
|
||||||
{
|
{
|
||||||
if (BasicIO)
|
if (BasicIO || Backend is null)
|
||||||
Console.WriteLine(line);
|
Console.WriteLine(line);
|
||||||
else
|
else
|
||||||
Backend.WriteLine(line);
|
Backend.WriteLine(line);
|
||||||
|
|
@ -137,7 +137,7 @@ namespace MinecraftClient
|
||||||
{
|
{
|
||||||
str = str.Replace('\n', ' ');
|
str = str.Replace('\n', ' ');
|
||||||
}
|
}
|
||||||
if (BasicIO)
|
if (BasicIO || Backend is null)
|
||||||
{
|
{
|
||||||
if (BasicIO_NoColor)
|
if (BasicIO_NoColor)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -161,14 +161,7 @@ namespace MinecraftClient
|
||||||
}
|
}
|
||||||
|
|
||||||
if (configResult.NeedWriteDefault)
|
if (configResult.NeedWriteDefault)
|
||||||
{
|
|
||||||
Config.Main.Advanced.Language = Settings.GetDefaultGameLanguage();
|
Config.Main.Advanced.Language = Settings.GetDefaultGameLanguage();
|
||||||
WriteBackSettings(false);
|
|
||||||
}
|
|
||||||
else if (configResult.Success)
|
|
||||||
{
|
|
||||||
WriteBackSettings(true);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!Config.Main.Advanced.EnableSentry)
|
if (!Config.Main.Advanced.EnableSentry)
|
||||||
_sentrySdk?.Dispose();
|
_sentrySdk?.Dispose();
|
||||||
|
|
@ -219,6 +212,8 @@ namespace MinecraftClient
|
||||||
|
|
||||||
if (cfg.NeedWriteDefault)
|
if (cfg.NeedWriteDefault)
|
||||||
{
|
{
|
||||||
|
WriteBackSettings(false);
|
||||||
|
|
||||||
if (cfg.IsLegacyUpgrade)
|
if (cfg.IsLegacyUpgrade)
|
||||||
{
|
{
|
||||||
ConsoleIO.WriteLineFormatted("§c" + Translations.mcc_use_new_config);
|
ConsoleIO.WriteLineFormatted("§c" + Translations.mcc_use_new_config);
|
||||||
|
|
@ -243,6 +238,8 @@ namespace MinecraftClient
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
WriteBackSettings(true);
|
||||||
|
|
||||||
if (!Config.Main.Advanced.Language.StartsWith("en"))
|
if (!Config.Main.Advanced.Language.StartsWith("en"))
|
||||||
ConsoleIO.WriteLine(string.Format(Translations.mcc_help_us_translate, Settings.TranslationProjectUrl));
|
ConsoleIO.WriteLine(string.Format(Translations.mcc_help_us_translate, Settings.TranslationProjectUrl));
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue