Remove color code from text

This commit is contained in:
BruceChen 2022-11-30 16:08:55 +08:00
parent 2b9c58de56
commit 6c3bfb82ee
12 changed files with 79 additions and 79 deletions

View file

@ -123,7 +123,7 @@ namespace MinecraftClient.ChatBots
Console.Beep();
Console.Beep();
}
LogToConsole(Translations.bot_alerts_start_rain);
LogToConsole("§c" + Translations.bot_alerts_start_rain);
}
}
else if (curRainLevel >= threshold && level < threshold)
@ -134,7 +134,7 @@ namespace MinecraftClient.ChatBots
{
Console.Beep();
}
LogToConsole(Translations.bot_alerts_end_rain);
LogToConsole("§c" + Translations.bot_alerts_end_rain);
}
}
curRainLevel = level;
@ -151,7 +151,7 @@ namespace MinecraftClient.ChatBots
Console.Beep();
Console.Beep();
}
LogToConsole(Translations.bot_alerts_start_thunderstorm);
LogToConsole("§c" + Translations.bot_alerts_start_thunderstorm);
}
}
else if (curThunderLevel >= threshold && level < threshold)
@ -162,7 +162,7 @@ namespace MinecraftClient.ChatBots
{
Console.Beep();
}
LogToConsole(Translations.bot_alerts_end_thunderstorm);
LogToConsole("§c" + Translations.bot_alerts_end_thunderstorm);
}
}
curThunderLevel = level;

View file

@ -127,7 +127,7 @@ namespace MinecraftClient.Commands
if (markedChunkPos != null &&
(((Math.Max(bottomMost, markChunkZ) - Math.Min(topMost, markChunkZ) + 1) > consoleHeight) ||
((Math.Max(rightMost, markChunkX) - Math.Min(leftMost, markChunkX) + 1) > consoleWidth)))
sb.AppendLine(Translations.cmd_chunk_outside);
sb.AppendLine("§x§0" + Translations.cmd_chunk_outside);
else
{
topMost = Math.Min(topMost, markChunkZ);
@ -173,7 +173,7 @@ namespace MinecraftClient.Commands
Tuple<int, int>? chunkPos = ParseChunkPos(args);
if (chunkPos != null)
{
handler.Log.Info(Translations.cmd_chunk_for_debug);
handler.Log.Info("§x§0" + Translations.cmd_chunk_for_debug);
World world = handler.GetWorld();
(int chunkX, int chunkZ) = chunkPos;
ChunkColumn? chunkColumn = world[chunkX, chunkZ];
@ -190,7 +190,7 @@ namespace MinecraftClient.Commands
Tuple<int, int>? chunkPos = ParseChunkPos(args);
if (chunkPos != null)
{
handler.Log.Info(Translations.cmd_chunk_for_debug);
handler.Log.Info("§x§0" + Translations.cmd_chunk_for_debug);
World world = handler.GetWorld();
(int chunkX, int chunkZ) = chunkPos;
ChunkColumn? chunkColumn = world[chunkX, chunkZ];
@ -207,7 +207,7 @@ namespace MinecraftClient.Commands
Tuple<int, int>? chunkPos = ParseChunkPos(args);
if (chunkPos != null)
{
handler.Log.Info(Translations.cmd_chunk_for_debug);
handler.Log.Info("§x§0" + Translations.cmd_chunk_for_debug);
World world = handler.GetWorld();
(int chunkX, int chunkZ) = chunkPos;
world[chunkX, chunkZ] = null;

View file

@ -25,7 +25,7 @@ namespace MinecraftClient
if (Settings.Config.Logging.DebugMessages)
{
string callerClass = new System.Diagnostics.StackFrame(1).GetMethod()!.DeclaringType!.Name;
ConsoleIO.WriteLineFormatted(string.Format(Translations.filemonitor_init, callerClass, Path.Combine(folder, filename)));
ConsoleIO.WriteLineFormatted("§8" + string.Format(Translations.filemonitor_init, callerClass, Path.Combine(folder, filename)));
}
try
@ -43,7 +43,7 @@ namespace MinecraftClient
if (Settings.Config.Logging.DebugMessages)
{
string callerClass = new System.Diagnostics.StackFrame(1).GetMethod()!.DeclaringType!.Name;
ConsoleIO.WriteLineFormatted(string.Format(Translations.filemonitor_fail, callerClass));
ConsoleIO.WriteLineFormatted("§8" + string.Format(Translations.filemonitor_fail, callerClass));
}
monitor = null;

View file

@ -139,7 +139,7 @@ namespace MinecraftClient
Config.Main.Advanced.Language = Settings.GetDefaultGameLanguage();
WriteBackSettings(false);
if (newlyGenerated)
ConsoleIO.WriteLineFormatted(Translations.mcc_settings_generated);
ConsoleIO.WriteLineFormatted("§c" + Translations.mcc_settings_generated);
ConsoleIO.WriteLine(Translations.mcc_run_with_default_settings);
}
else if (!loadSucceed)
@ -289,7 +289,7 @@ namespace MinecraftClient
if (Settings.CheckUpdate(Config.Head.CurrentVersion, Config.Head.LatestVersion))
{
needPromptUpdate = false;
ConsoleIO.WriteLineFormatted(string.Format(Translations.mcc_has_update, Settings.GithubReleaseUrl));
ConsoleIO.WriteLineFormatted("§e" + string.Format(Translations.mcc_has_update, Settings.GithubReleaseUrl));
}
Task.Run(() =>
{
@ -310,7 +310,7 @@ namespace MinecraftClient
string latestVersion = string.Format("GitHub build {0}, built on {1}-{2}-{3}", run, year, month, day);
if (needPromptUpdate)
if (Settings.CheckUpdate(Config.Head.CurrentVersion, Config.Head.LatestVersion))
ConsoleIO.WriteLineFormatted(string.Format(Translations.mcc_has_update, Settings.GithubReleaseUrl));
ConsoleIO.WriteLineFormatted("§e" + string.Format(Translations.mcc_has_update, Settings.GithubReleaseUrl));
if (latestVersion != Config.Head.LatestVersion)
{
Config.Head.LatestVersion = latestVersion;
@ -381,7 +381,7 @@ namespace MinecraftClient
{
bool cacheLoaded = SessionCache.InitializeDiskCache();
if (Config.Logging.DebugMessages)
ConsoleIO.WriteLineFormatted(cacheLoaded ? Translations.debug_session_cache_ok : Translations.debug_session_cache_fail, acceptnewlines: true);
ConsoleIO.WriteLineFormatted("§8" + (cacheLoaded ? Translations.debug_session_cache_ok : Translations.debug_session_cache_fail), acceptnewlines: true);
}
// Setup exit cleaning code
@ -415,7 +415,7 @@ namespace MinecraftClient
/// </summary>
private static void RequestPassword()
{
ConsoleIO.WriteLine(ConsoleIO.BasicIO ? string.Format(Translations.mcc_password_basic_io, InternalConfig.Account.Login) + "\n" : Translations.mcc_password);
ConsoleIO.WriteLine(ConsoleIO.BasicIO ? string.Format(Translations.mcc_password_basic_io, InternalConfig.Account.Login) + "\n" : Translations.mcc_password_hidden);
string? password = ConsoleIO.BasicIO ? Console.ReadLine() : ConsoleIO.ReadPassword();
if (string.IsNullOrWhiteSpace(password))
InternalConfig.Account.Password = "-";
@ -438,7 +438,7 @@ namespace MinecraftClient
string loginLower = ToLowerIfNeed(InternalConfig.Account.Login);
if (InternalConfig.Account.Password == "-")
{
ConsoleIO.WriteLineFormatted(Translations.mcc_offline, acceptnewlines: true);
ConsoleIO.WriteLineFormatted("§8" + Translations.mcc_offline, acceptnewlines: true);
result = ProtocolHandler.LoginResult.Success;
session.PlayerID = "0";
session.PlayerName = InternalConfig.Username;
@ -452,7 +452,7 @@ namespace MinecraftClient
result = ProtocolHandler.GetTokenValidation(session);
if (result != ProtocolHandler.LoginResult.Success)
{
ConsoleIO.WriteLineFormatted(Translations.mcc_session_invalid, acceptnewlines: true);
ConsoleIO.WriteLineFormatted("§8" + Translations.mcc_session_invalid, acceptnewlines: true);
// Try to refresh access token
if (!string.IsNullOrWhiteSpace(session.RefreshToken))
{
@ -472,7 +472,7 @@ namespace MinecraftClient
&& !(Config.Main.General.AccountType == LoginType.microsoft && Config.Main.General.Method == LoginMethod.browser))
RequestPassword();
}
else ConsoleIO.WriteLineFormatted(string.Format(Translations.mcc_session_valid, session.PlayerName));
else ConsoleIO.WriteLineFormatted("§8" + string.Format(Translations.mcc_session_valid, session.PlayerName));
}
if (result != ProtocolHandler.LoginResult.Success)
@ -563,7 +563,7 @@ namespace MinecraftClient
if (protocolversion != 0)
ConsoleIO.WriteLineFormatted(string.Format(Translations.mcc_use_version, InternalConfig.MinecraftVersion, protocolversion));
else
ConsoleIO.WriteLineFormatted(string.Format(Translations.mcc_unknown_version, InternalConfig.MinecraftVersion));
ConsoleIO.WriteLineFormatted("§8" + string.Format(Translations.mcc_unknown_version, InternalConfig.MinecraftVersion));
if (useMcVersionOnce)
{
@ -597,16 +597,16 @@ namespace MinecraftClient
{
bool cacheKeyLoaded = KeysCache.InitializeDiskCache();
if (Config.Logging.DebugMessages)
ConsoleIO.WriteLineFormatted(cacheKeyLoaded ? Translations.debug_keys_cache_ok : Translations.debug_keys_cache_fail, acceptnewlines: true);
ConsoleIO.WriteLineFormatted("§8" + (cacheKeyLoaded ? Translations.debug_keys_cache_ok : Translations.debug_keys_cache_fail), acceptnewlines: true);
}
if (Config.Main.Advanced.ProfileKeyCache != CacheType.none && KeysCache.Contains(loginLower))
{
playerKeyPair = KeysCache.Get(loginLower);
if (playerKeyPair.NeedRefresh())
ConsoleIO.WriteLineFormatted(Translations.mcc_profile_key_invalid, acceptnewlines: true);
ConsoleIO.WriteLineFormatted("§8" + Translations.mcc_profile_key_invalid, acceptnewlines: true);
else
ConsoleIO.WriteLineFormatted(string.Format(Translations.mcc_profile_key_valid, session.PlayerName));
ConsoleIO.WriteLineFormatted("§8" + string.Format(Translations.mcc_profile_key_valid, session.PlayerName));
}
if (playerKeyPair == null || playerKeyPair.NeedRefresh())
@ -720,7 +720,7 @@ namespace MinecraftClient
public static void DoExit(int exitcode = 0)
{
WriteBackSettings(true);
ConsoleIO.WriteLineFormatted(string.Format(Translations.config_saving, settingsIniPath));
ConsoleIO.WriteLineFormatted("§a" + string.Format(Translations.config_saving, settingsIniPath));
if (client != null) { client.Disconnect(); ConsoleIO.Reset(); }
if (offlinePrompt != null) { offlinePrompt.Item2.Cancel(); offlinePrompt.Item1.Join(); offlinePrompt = null; ConsoleIO.Reset(); }

View file

@ -43,19 +43,19 @@ namespace MinecraftClient.Protocol.Handlers
if (Handler.GetTerrainEnabled())
{
ConsoleIO.WriteLineFormatted(Translations.extra_terrainandmovement_disabled, acceptnewlines: true);
ConsoleIO.WriteLineFormatted("§c" + Translations.extra_terrainandmovement_disabled, acceptnewlines: true);
Handler.SetTerrainEnabled(false);
}
if (handler.GetInventoryEnabled())
{
ConsoleIO.WriteLineFormatted(Translations.extra_inventory_disabled, acceptnewlines: true);
ConsoleIO.WriteLineFormatted("§c" + Translations.extra_inventory_disabled, acceptnewlines: true);
handler.SetInventoryEnabled(false);
}
if (handler.GetEntityHandlingEnabled())
{
ConsoleIO.WriteLineFormatted(Translations.extra_entity_disabled, acceptnewlines: true);
ConsoleIO.WriteLineFormatted("§c" + Translations.extra_entity_disabled, acceptnewlines: true);
handler.SetEntityHandlingEnabled(false);
}
}
@ -494,15 +494,15 @@ namespace MinecraftClient.Protocol.Handlers
byte[] token = ReadNextByteArray();
if (serverID == "-")
ConsoleIO.WriteLineFormatted(Translations.mcc_server_offline, acceptnewlines: true);
ConsoleIO.WriteLineFormatted("§8" + Translations.mcc_server_offline, acceptnewlines: true);
else if (Settings.Config.Logging.DebugMessages)
ConsoleIO.WriteLineFormatted(string.Format(Translations.mcc_handshake, serverID));
ConsoleIO.WriteLineFormatted("§8" + string.Format(Translations.mcc_handshake, serverID));
return StartEncryption(uuid, username, sessionID, token, serverID, PublicServerkey, session);
}
else
{
ConsoleIO.WriteLineFormatted(Translations.error_invalid_response, acceptnewlines: true);
ConsoleIO.WriteLineFormatted("§8" + Translations.error_invalid_response, acceptnewlines: true);
return false;
}
}
@ -513,7 +513,7 @@ namespace MinecraftClient.Protocol.Handlers
byte[] secretKey = CryptoHandler.ClientAESPrivateKey ?? CryptoHandler.GenerateAESPrivateKey();
if (Settings.Config.Logging.DebugMessages)
ConsoleIO.WriteLineFormatted(Translations.debug_crypto, acceptnewlines: true);
ConsoleIO.WriteLineFormatted("§8" + Translations.debug_crypto, acceptnewlines: true);
if (serverIDhash != "-")
{
@ -578,7 +578,7 @@ namespace MinecraftClient.Protocol.Handlers
}
else
{
ConsoleIO.WriteLineFormatted(Translations.error_invalid_encrypt, acceptnewlines: true);
ConsoleIO.WriteLineFormatted("§8" + Translations.error_invalid_encrypt, acceptnewlines: true);
return false;
}
}

View file

@ -107,18 +107,18 @@ namespace MinecraftClient.Protocol.Handlers
if (handler.GetTerrainEnabled() && protocolVersion > MC_1_19_2_Version)
{
log.Error(Translations.extra_terrainandmovement_disabled);
log.Error("§c" + Translations.extra_terrainandmovement_disabled);
handler.SetTerrainEnabled(false);
}
if (handler.GetInventoryEnabled() && (protocolVersion < MC_1_10_Version || protocolVersion > MC_1_19_2_Version))
{
log.Error(Translations.extra_inventory_disabled);
log.Error("§c" + Translations.extra_inventory_disabled);
handler.SetInventoryEnabled(false);
}
if (handler.GetEntityHandlingEnabled() && (protocolVersion < MC_1_10_Version || protocolVersion > MC_1_19_2_Version))
{
log.Error(Translations.extra_entity_disabled);
log.Error("§c" + Translations.extra_entity_disabled);
handler.SetEntityHandlingEnabled(false);
}
@ -1956,12 +1956,12 @@ namespace MinecraftClient.Protocol.Handlers
}
else if (packetID == 0x02) //Login successful
{
log.Info(Translations.mcc_server_offline);
log.Info("§8" + Translations.mcc_server_offline);
login_phase = false;
if (!pForge.CompleteForgeHandshake())
{
log.Error(Translations.error_forge);
log.Error("§8" + Translations.error_forge);
return false;
}
@ -1981,7 +1981,7 @@ namespace MinecraftClient.Protocol.Handlers
RSACryptoServiceProvider RSAService = CryptoHandler.DecodeRSAPublicKey(serverPublicKey)!;
byte[] secretKey = CryptoHandler.ClientAESPrivateKey ?? CryptoHandler.GenerateAESPrivateKey();
log.Debug(Translations.debug_crypto);
log.Debug("§8" + Translations.debug_crypto);
if (serverIDhash != "-")
{
@ -2050,7 +2050,7 @@ namespace MinecraftClient.Protocol.Handlers
(int packetID, Queue<byte> packetData) = ReadNextPacket();
if (packetID < 0 || loopPrevention-- < 0) // Failed to read packet or too many iterations (issue #1150)
{
handler.OnConnectionLost(ChatBot.DisconnectReason.ConnectionLost, Translations.error_invalid_encrypt);
handler.OnConnectionLost(ChatBot.DisconnectReason.ConnectionLost, "§8" + Translations.error_invalid_encrypt);
return false;
}
else if (packetID == 0x00) //Login rejected
@ -2086,7 +2086,7 @@ namespace MinecraftClient.Protocol.Handlers
if (!pForge.CompleteForgeHandshake())
{
log.Error(Translations.error_forge_encrypt);
log.Error("§8" + Translations.error_forge_encrypt);
return false;
}
@ -2224,7 +2224,7 @@ namespace MinecraftClient.Protocol.Handlers
// Check for forge on the server.
Protocol18Forge.ServerInfoCheckForge(jsonData, ref forgeInfo);
ConsoleIO.WriteLineFormatted(string.Format(Translations.mcc_server_protocol, version, protocolVersion + (forgeInfo != null ? Translations.mcc_with_forge : "")));
ConsoleIO.WriteLineFormatted("§8" + string.Format(Translations.mcc_server_protocol, version, protocolVersion + (forgeInfo != null ? Translations.mcc_with_forge : "")));
return true;
}

View file

@ -131,7 +131,7 @@ namespace MinecraftClient.Protocol.Handlers
byte fmlProtocolVersion = dataTypes.ReadNextByte(packetData);
if (Settings.Config.Logging.DebugMessages)
ConsoleIO.WriteLineFormatted(string.Format(Translations.forge_version, fmlProtocolVersion));
ConsoleIO.WriteLineFormatted("§8" + string.Format(Translations.forge_version, fmlProtocolVersion));
if (fmlProtocolVersion >= 1)
currentDimension = dataTypes.ReadNextInt(packetData);
@ -141,7 +141,7 @@ namespace MinecraftClient.Protocol.Handlers
// Then tell the server that we're running the same mods.
if (Settings.Config.Logging.DebugMessages)
ConsoleIO.WriteLineFormatted(Translations.forge_send_mod, acceptnewlines: true);
ConsoleIO.WriteLineFormatted("§8" + Translations.forge_send_mod, acceptnewlines: true);
byte[][] mods = new byte[forgeInfo.Mods.Count][];
for (int i = 0; i < forgeInfo.Mods.Count; i++)
{
@ -161,7 +161,7 @@ namespace MinecraftClient.Protocol.Handlers
Thread.Sleep(2000);
if (Settings.Config.Logging.DebugMessages)
ConsoleIO.WriteLineFormatted(Translations.forge_accept, acceptnewlines: true);
ConsoleIO.WriteLineFormatted("§8" + Translations.forge_accept, acceptnewlines: true);
// Tell the server that yes, we are OK with the mods it has
// even though we don't actually care what mods it has.
@ -183,7 +183,7 @@ namespace MinecraftClient.Protocol.Handlers
int registrySize = dataTypes.ReadNextVarInt(packetData);
if (Settings.Config.Logging.DebugMessages)
ConsoleIO.WriteLineFormatted(string.Format(Translations.forge_registry, registrySize));
ConsoleIO.WriteLineFormatted("§8" + string.Format(Translations.forge_registry, registrySize));
fmlHandshakeState = FMLHandshakeClientState.PENDINGCOMPLETE;
}
@ -195,7 +195,7 @@ namespace MinecraftClient.Protocol.Handlers
string registryName = dataTypes.ReadNextString(packetData);
int registrySize = dataTypes.ReadNextVarInt(packetData);
if (Settings.Config.Logging.DebugMessages)
ConsoleIO.WriteLineFormatted(string.Format(Translations.forge_registry_2, registryName, registrySize));
ConsoleIO.WriteLineFormatted("§8" + string.Format(Translations.forge_registry_2, registryName, registrySize));
if (!hasNextRegistry)
fmlHandshakeState = FMLHandshakeClientState.PENDINGCOMPLETE;
}
@ -207,7 +207,7 @@ namespace MinecraftClient.Protocol.Handlers
if (discriminator != FMLHandshakeDiscriminator.HandshakeAck)
return false;
if (Settings.Config.Logging.DebugMessages)
ConsoleIO.WriteLineFormatted(Translations.forge_accept_registry, acceptnewlines: true);
ConsoleIO.WriteLineFormatted("§8" + Translations.forge_accept_registry, acceptnewlines: true);
SendForgeHandshakePacket(FMLHandshakeDiscriminator.HandshakeAck,
new byte[] { (byte)FMLHandshakeClientState.PENDINGCOMPLETE });
fmlHandshakeState = FMLHandshakeClientState.COMPLETE;
@ -301,7 +301,7 @@ namespace MinecraftClient.Protocol.Handlers
// [1]: Version is usually set to "FML2" for FML stuff and "1" for mods
if (Settings.Config.Logging.DebugMessages)
ConsoleIO.WriteLineFormatted(Translations.forge_fml2_mod, acceptnewlines: true);
ConsoleIO.WriteLineFormatted("§8" + Translations.forge_fml2_mod, acceptnewlines: true);
List<string> mods = new();
int modCount = dataTypes.ReadNextVarInt(packetData);
@ -333,7 +333,7 @@ namespace MinecraftClient.Protocol.Handlers
// In MCC, we just want to send a valid response so we'll reply back with data collected from the server.
if (Settings.Config.Logging.DebugMessages)
ConsoleIO.WriteLineFormatted(Translations.forge_fml2_mod_send, acceptnewlines: true);
ConsoleIO.WriteLineFormatted("§8" + Translations.forge_fml2_mod_send, acceptnewlines: true);
// Packet ID 2: Client to Server Mod List
fmlResponsePacket.AddRange(dataTypes.GetVarInt(2));
@ -371,7 +371,7 @@ namespace MinecraftClient.Protocol.Handlers
if (Settings.Config.Logging.DebugMessages)
{
string registryName = dataTypes.ReadNextString(packetData);
ConsoleIO.WriteLineFormatted(string.Format(Translations.forge_fml2_registry, registryName));
ConsoleIO.WriteLineFormatted("§8" + string.Format(Translations.forge_fml2_registry, registryName));
}
fmlResponsePacket.AddRange(dataTypes.GetVarInt(99));
@ -390,7 +390,7 @@ namespace MinecraftClient.Protocol.Handlers
if (Settings.Config.Logging.DebugMessages)
{
string configName = dataTypes.ReadNextString(packetData);
ConsoleIO.WriteLineFormatted(string.Format(Translations.forge_fml2_config, configName));
ConsoleIO.WriteLineFormatted("§8" + string.Format(Translations.forge_fml2_config, configName));
}
fmlResponsePacket.AddRange(dataTypes.GetVarInt(99));
@ -399,7 +399,7 @@ namespace MinecraftClient.Protocol.Handlers
default:
if (Settings.Config.Logging.DebugMessages)
ConsoleIO.WriteLineFormatted(string.Format(Translations.forge_fml2_unknown, packetID));
ConsoleIO.WriteLineFormatted("§8" + string.Format(Translations.forge_fml2_unknown, packetID));
break;
}
@ -415,7 +415,7 @@ namespace MinecraftClient.Protocol.Handlers
}
else if (Settings.Config.Logging.DebugMessages)
{
ConsoleIO.WriteLineFormatted(string.Format(Translations.forge_fml2_unknown_channel, fmlChannel));
ConsoleIO.WriteLineFormatted("§8" + string.Format(Translations.forge_fml2_unknown_channel, fmlChannel));
}
}
return false;
@ -504,10 +504,10 @@ namespace MinecraftClient.Protocol.Handlers
forgeInfo = new ForgeInfo(modData, fmlVersion);
if (forgeInfo.Mods.Any())
{
ConsoleIO.WriteLineFormatted(string.Format(Translations.forge_with_mod, forgeInfo.Mods.Count));
ConsoleIO.WriteLineFormatted("§8" + string.Format(Translations.forge_with_mod, forgeInfo.Mods.Count));
if (Settings.Config.Logging.DebugMessages)
{
ConsoleIO.WriteLineFormatted(Translations.forge_mod_list, acceptnewlines: true);
ConsoleIO.WriteLineFormatted("§8" + Translations.forge_mod_list, acceptnewlines: true);
foreach (ForgeInfo.ForgeMod mod in forgeInfo.Mods)
ConsoleIO.WriteLineFormatted("§8 " + mod.ToString());
}
@ -515,7 +515,7 @@ namespace MinecraftClient.Protocol.Handlers
}
else
{
ConsoleIO.WriteLineFormatted(Translations.forge_no_mod, acceptnewlines: true);
ConsoleIO.WriteLineFormatted("§8" + Translations.forge_no_mod, acceptnewlines: true);
forgeInfo = null;
}
}

View file

@ -219,7 +219,7 @@ namespace MinecraftClient.Protocol
//File not found? Try downloading language file from Mojang's servers?
if (!File.Exists(Language_File))
{
ConsoleIO.WriteLineFormatted(string.Format(Translations.chat_download, Config.Main.Advanced.Language));
ConsoleIO.WriteLineFormatted("§8" + string.Format(Translations.chat_download, Config.Main.Advanced.Language));
HttpClient httpClient = new();
try
{
@ -233,7 +233,7 @@ namespace MinecraftClient.Protocol
string hash = tmp[1].Split('"')[0]; //Translations file identifier on Mojang's servers
string translation_file_location = Settings.TranslationsFile_Website_Download + '/' + hash[..2] + '/' + hash;
if (Settings.Config.Logging.DebugMessages)
ConsoleIO.WriteLineFormatted(string.Format(Translations.chat_request, translation_file_location));
ConsoleIO.WriteLineFormatted("§8" + string.Format(Translations.chat_request, translation_file_location));
Task<string> fetch_file = httpClient.GetStringAsync(translation_file_location);
fetch_file.Wait();
@ -245,11 +245,11 @@ namespace MinecraftClient.Protocol
stringBuilder.Append(entry.Key).Append('=').Append(entry.Value.StringValue.Replace("\n", "\\n").Replace("\r", String.Empty)).Append(Environment.NewLine);
File.WriteAllText(Language_File, stringBuilder.ToString());
ConsoleIO.WriteLineFormatted(string.Format(Translations.chat_done, Language_File));
ConsoleIO.WriteLineFormatted("§8" + string.Format(Translations.chat_done, Language_File));
}
catch
{
ConsoleIO.WriteLineFormatted(Translations.chat_fail, acceptnewlines: true);
ConsoleIO.WriteLineFormatted("§8" + Translations.chat_fail, acceptnewlines: true);
}
httpClient.Dispose();
}
@ -259,7 +259,7 @@ namespace MinecraftClient.Protocol
&& File.Exists(Settings.TranslationsFile_FromMCDir))
{
Language_File = Settings.TranslationsFile_FromMCDir;
ConsoleIO.WriteLineFormatted(Translations.chat_from_dir, acceptnewlines: true);
ConsoleIO.WriteLineFormatted("§8" + Translations.chat_from_dir, acceptnewlines: true);
}
//Load the external dictionnary of translation rules or display an error message
@ -278,11 +278,11 @@ namespace MinecraftClient.Protocol
}
if (Settings.Config.Logging.DebugMessages)
ConsoleIO.WriteLineFormatted(Translations.chat_loaded, acceptnewlines: true);
ConsoleIO.WriteLineFormatted("§8" + Translations.chat_loaded, acceptnewlines: true);
}
else //No external dictionnary found.
{
ConsoleIO.WriteLineFormatted(string.Format(Translations.chat_not_found, Language_File));
ConsoleIO.WriteLineFormatted("§8" + string.Format(Translations.chat_not_found, Language_File));
}
}

View file

@ -163,7 +163,7 @@ namespace MinecraftClient.Protocol.Keys
}
catch (IOException e)
{
ConsoleIO.WriteLineFormatted(string.Format(Translations.cache_read_fail_plain_keys, e.Message));
ConsoleIO.WriteLineFormatted("§8" + string.Format(Translations.cache_read_fail_plain_keys, e.Message));
}
}
@ -176,7 +176,7 @@ namespace MinecraftClient.Protocol.Keys
private static void SaveToDisk()
{
if (Config.Logging.DebugMessages)
ConsoleIO.WriteLineFormatted(Translations.cache_saving_keys, acceptnewlines: true);
ConsoleIO.WriteLineFormatted("§8" + Translations.cache_saving_keys, acceptnewlines: true);
List<string> KeysCacheLines = new()
{
@ -192,7 +192,7 @@ namespace MinecraftClient.Protocol.Keys
}
catch (IOException e)
{
ConsoleIO.WriteLineFormatted(string.Format(Translations.cache_save_fail_keys, e.Message));
ConsoleIO.WriteLineFormatted("§8" + string.Format(Translations.cache_save_fail_keys, e.Message));
}
}
}

View file

@ -56,7 +56,7 @@ namespace MinecraftClient.Protocol
.ThenBy(record => Guid.NewGuid())
.First();
string target = result.Target.Value.Trim('.');
ConsoleIO.WriteLineFormatted(string.Format(Translations.mcc_found, target, result.Port, domainVal));
ConsoleIO.WriteLineFormatted("§8" + string.Format(Translations.mcc_found, target, result.Port, domainVal));
domainVal = target;
portVal = result.Port;
foundService = true;
@ -64,7 +64,7 @@ namespace MinecraftClient.Protocol
}
catch (Exception e)
{
ConsoleIO.WriteLineFormatted(string.Format(Translations.mcc_not_found, domainVal, e.GetType().FullName, e.Message));
ConsoleIO.WriteLineFormatted("§8" + string.Format(Translations.mcc_not_found, domainVal, e.GetType().FullName, e.Message));
}
}, TimeSpan.FromSeconds(Config.Main.Advanced.ResolveSrvRecords == MainConfigHealper.MainConfig.AdvancedConfig.ResolveSrvRecordType.fast ? 10 : 30));
}
@ -96,7 +96,7 @@ namespace MinecraftClient.Protocol
success = true;
}
else
ConsoleIO.WriteLineFormatted(Translations.error_unexpect_response, acceptnewlines: true);
ConsoleIO.WriteLineFormatted("§8" + Translations.error_unexpect_response, acceptnewlines: true);
}
catch (Exception e)
{
@ -105,9 +105,9 @@ namespace MinecraftClient.Protocol
}, TimeSpan.FromSeconds(Config.Main.Advanced.ResolveSrvRecords == MainConfigHealper.MainConfig.AdvancedConfig.ResolveSrvRecordType.fast ? 10 : 30)))
{
if (protocolversion != 0 && protocolversion != protocolversionTmp)
ConsoleIO.WriteLineFormatted(Translations.error_version_different, acceptnewlines: true);
ConsoleIO.WriteLineFormatted("§8" + Translations.error_version_different, acceptnewlines: true);
if (protocolversion == 0 && protocolversionTmp <= 1)
ConsoleIO.WriteLineFormatted(Translations.error_no_version_report, acceptnewlines: true);
ConsoleIO.WriteLineFormatted("§8" + Translations.error_no_version_report, acceptnewlines: true);
if (protocolversion == 0)
protocolversion = protocolversionTmp;
forgeInfo = forgeInfoTmp;
@ -115,7 +115,7 @@ namespace MinecraftClient.Protocol
}
else
{
ConsoleIO.WriteLineFormatted(Translations.error_connection_timeout, acceptnewlines: true);
ConsoleIO.WriteLineFormatted("§8" + Translations.error_connection_timeout, acceptnewlines: true);
return false;
}
}
@ -491,7 +491,7 @@ namespace MinecraftClient.Protocol
}
else
{
ConsoleIO.WriteLineFormatted(string.Format(Translations.error_http_code, code));
ConsoleIO.WriteLineFormatted("§8" + string.Format(Translations.error_http_code, code));
return LoginResult.OtherError;
}
}
@ -694,7 +694,7 @@ namespace MinecraftClient.Protocol
}
else
{
ConsoleIO.WriteLineFormatted(string.Format(Translations.error_auth, code));
ConsoleIO.WriteLineFormatted("§8" + string.Format(Translations.error_auth, code));
return LoginResult.OtherError;
}
}
@ -895,7 +895,7 @@ namespace MinecraftClient.Protocol
try
{
if (Settings.Config.Logging.DebugMessages)
ConsoleIO.WriteLineFormatted(string.Format(Translations.debug_request, host));
ConsoleIO.WriteLineFormatted("§8" + string.Format(Translations.debug_request, host));
TcpClient client = ProxyHandler.NewTcpClient(host, 443, true);
SslStream stream = new(client.GetStream());

View file

@ -190,7 +190,7 @@ namespace MinecraftClient.Protocol.Session
}
catch (IOException ex)
{
ConsoleIO.WriteLineFormatted(string.Format(Translations.cache_read_fail, ex.Message));
ConsoleIO.WriteLineFormatted("§8" + string.Format(Translations.cache_read_fail, ex.Message));
}
catch (SerializationException ex2)
{
@ -236,7 +236,7 @@ namespace MinecraftClient.Protocol.Session
}
catch (IOException e)
{
ConsoleIO.WriteLineFormatted(string.Format(Translations.cache_read_fail_plain, e.Message));
ConsoleIO.WriteLineFormatted("§8" + string.Format(Translations.cache_read_fail_plain, e.Message));
}
}
@ -249,7 +249,7 @@ namespace MinecraftClient.Protocol.Session
private static void SaveToDisk()
{
if (Config.Logging.DebugMessages)
ConsoleIO.WriteLineFormatted(Translations.cache_saving, acceptnewlines: true);
ConsoleIO.WriteLineFormatted("§8" + Translations.cache_saving, acceptnewlines: true);
List<string> sessionCacheLines = new()
{
@ -265,7 +265,7 @@ namespace MinecraftClient.Protocol.Session
}
catch (IOException e)
{
ConsoleIO.WriteLineFormatted(string.Format(Translations.cache_save_fail, e.Message));
ConsoleIO.WriteLineFormatted("§8" + string.Format(Translations.cache_save_fail, e.Message));
}
}
}

View file

@ -86,7 +86,7 @@ namespace MinecraftClient.Proxy
if (!proxy_ok)
{
ConsoleIO.WriteLineFormatted(string.Format(Translations.proxy_connected, Config.Server.Host, Config.Server.Port));
ConsoleIO.WriteLineFormatted("§8" + string.Format(Translations.proxy_connected, Config.Server.Host, Config.Server.Port));
proxy_ok = true;
}