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

View file

@ -127,7 +127,7 @@ namespace MinecraftClient.Commands
if (markedChunkPos != null && if (markedChunkPos != null &&
(((Math.Max(bottomMost, markChunkZ) - Math.Min(topMost, markChunkZ) + 1) > consoleHeight) || (((Math.Max(bottomMost, markChunkZ) - Math.Min(topMost, markChunkZ) + 1) > consoleHeight) ||
((Math.Max(rightMost, markChunkX) - Math.Min(leftMost, markChunkX) + 1) > consoleWidth))) ((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 else
{ {
topMost = Math.Min(topMost, markChunkZ); topMost = Math.Min(topMost, markChunkZ);
@ -173,7 +173,7 @@ namespace MinecraftClient.Commands
Tuple<int, int>? chunkPos = ParseChunkPos(args); Tuple<int, int>? chunkPos = ParseChunkPos(args);
if (chunkPos != null) 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(); World world = handler.GetWorld();
(int chunkX, int chunkZ) = chunkPos; (int chunkX, int chunkZ) = chunkPos;
ChunkColumn? chunkColumn = world[chunkX, chunkZ]; ChunkColumn? chunkColumn = world[chunkX, chunkZ];
@ -190,7 +190,7 @@ namespace MinecraftClient.Commands
Tuple<int, int>? chunkPos = ParseChunkPos(args); Tuple<int, int>? chunkPos = ParseChunkPos(args);
if (chunkPos != null) 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(); World world = handler.GetWorld();
(int chunkX, int chunkZ) = chunkPos; (int chunkX, int chunkZ) = chunkPos;
ChunkColumn? chunkColumn = world[chunkX, chunkZ]; ChunkColumn? chunkColumn = world[chunkX, chunkZ];
@ -207,7 +207,7 @@ namespace MinecraftClient.Commands
Tuple<int, int>? chunkPos = ParseChunkPos(args); Tuple<int, int>? chunkPos = ParseChunkPos(args);
if (chunkPos != null) 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(); World world = handler.GetWorld();
(int chunkX, int chunkZ) = chunkPos; (int chunkX, int chunkZ) = chunkPos;
world[chunkX, chunkZ] = null; world[chunkX, chunkZ] = null;

View file

@ -25,7 +25,7 @@ namespace MinecraftClient
if (Settings.Config.Logging.DebugMessages) if (Settings.Config.Logging.DebugMessages)
{ {
string callerClass = new System.Diagnostics.StackFrame(1).GetMethod()!.DeclaringType!.Name; 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 try
@ -43,7 +43,7 @@ namespace MinecraftClient
if (Settings.Config.Logging.DebugMessages) if (Settings.Config.Logging.DebugMessages)
{ {
string callerClass = new System.Diagnostics.StackFrame(1).GetMethod()!.DeclaringType!.Name; 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; monitor = null;

View file

@ -139,7 +139,7 @@ namespace MinecraftClient
Config.Main.Advanced.Language = Settings.GetDefaultGameLanguage(); Config.Main.Advanced.Language = Settings.GetDefaultGameLanguage();
WriteBackSettings(false); WriteBackSettings(false);
if (newlyGenerated) if (newlyGenerated)
ConsoleIO.WriteLineFormatted(Translations.mcc_settings_generated); ConsoleIO.WriteLineFormatted("§c" + Translations.mcc_settings_generated);
ConsoleIO.WriteLine(Translations.mcc_run_with_default_settings); ConsoleIO.WriteLine(Translations.mcc_run_with_default_settings);
} }
else if (!loadSucceed) else if (!loadSucceed)
@ -289,7 +289,7 @@ namespace MinecraftClient
if (Settings.CheckUpdate(Config.Head.CurrentVersion, Config.Head.LatestVersion)) if (Settings.CheckUpdate(Config.Head.CurrentVersion, Config.Head.LatestVersion))
{ {
needPromptUpdate = false; 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(() => Task.Run(() =>
{ {
@ -310,7 +310,7 @@ namespace MinecraftClient
string latestVersion = string.Format("GitHub build {0}, built on {1}-{2}-{3}", run, year, month, day); string latestVersion = string.Format("GitHub build {0}, built on {1}-{2}-{3}", run, year, month, day);
if (needPromptUpdate) if (needPromptUpdate)
if (Settings.CheckUpdate(Config.Head.CurrentVersion, Config.Head.LatestVersion)) 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) if (latestVersion != Config.Head.LatestVersion)
{ {
Config.Head.LatestVersion = latestVersion; Config.Head.LatestVersion = latestVersion;
@ -381,7 +381,7 @@ namespace MinecraftClient
{ {
bool cacheLoaded = SessionCache.InitializeDiskCache(); bool cacheLoaded = SessionCache.InitializeDiskCache();
if (Config.Logging.DebugMessages) 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 // Setup exit cleaning code
@ -415,7 +415,7 @@ namespace MinecraftClient
/// </summary> /// </summary>
private static void RequestPassword() 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(); string? password = ConsoleIO.BasicIO ? Console.ReadLine() : ConsoleIO.ReadPassword();
if (string.IsNullOrWhiteSpace(password)) if (string.IsNullOrWhiteSpace(password))
InternalConfig.Account.Password = "-"; InternalConfig.Account.Password = "-";
@ -438,7 +438,7 @@ namespace MinecraftClient
string loginLower = ToLowerIfNeed(InternalConfig.Account.Login); string loginLower = ToLowerIfNeed(InternalConfig.Account.Login);
if (InternalConfig.Account.Password == "-") if (InternalConfig.Account.Password == "-")
{ {
ConsoleIO.WriteLineFormatted(Translations.mcc_offline, acceptnewlines: true); ConsoleIO.WriteLineFormatted("§8" + Translations.mcc_offline, acceptnewlines: true);
result = ProtocolHandler.LoginResult.Success; result = ProtocolHandler.LoginResult.Success;
session.PlayerID = "0"; session.PlayerID = "0";
session.PlayerName = InternalConfig.Username; session.PlayerName = InternalConfig.Username;
@ -452,7 +452,7 @@ namespace MinecraftClient
result = ProtocolHandler.GetTokenValidation(session); result = ProtocolHandler.GetTokenValidation(session);
if (result != ProtocolHandler.LoginResult.Success) 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 // Try to refresh access token
if (!string.IsNullOrWhiteSpace(session.RefreshToken)) if (!string.IsNullOrWhiteSpace(session.RefreshToken))
{ {
@ -472,7 +472,7 @@ namespace MinecraftClient
&& !(Config.Main.General.AccountType == LoginType.microsoft && Config.Main.General.Method == LoginMethod.browser)) && !(Config.Main.General.AccountType == LoginType.microsoft && Config.Main.General.Method == LoginMethod.browser))
RequestPassword(); 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) if (result != ProtocolHandler.LoginResult.Success)
@ -563,7 +563,7 @@ namespace MinecraftClient
if (protocolversion != 0) if (protocolversion != 0)
ConsoleIO.WriteLineFormatted(string.Format(Translations.mcc_use_version, InternalConfig.MinecraftVersion, protocolversion)); ConsoleIO.WriteLineFormatted(string.Format(Translations.mcc_use_version, InternalConfig.MinecraftVersion, protocolversion));
else else
ConsoleIO.WriteLineFormatted(string.Format(Translations.mcc_unknown_version, InternalConfig.MinecraftVersion)); ConsoleIO.WriteLineFormatted("§8" + string.Format(Translations.mcc_unknown_version, InternalConfig.MinecraftVersion));
if (useMcVersionOnce) if (useMcVersionOnce)
{ {
@ -597,16 +597,16 @@ namespace MinecraftClient
{ {
bool cacheKeyLoaded = KeysCache.InitializeDiskCache(); bool cacheKeyLoaded = KeysCache.InitializeDiskCache();
if (Config.Logging.DebugMessages) 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)) if (Config.Main.Advanced.ProfileKeyCache != CacheType.none && KeysCache.Contains(loginLower))
{ {
playerKeyPair = KeysCache.Get(loginLower); playerKeyPair = KeysCache.Get(loginLower);
if (playerKeyPair.NeedRefresh()) if (playerKeyPair.NeedRefresh())
ConsoleIO.WriteLineFormatted(Translations.mcc_profile_key_invalid, acceptnewlines: true); ConsoleIO.WriteLineFormatted("§8" + Translations.mcc_profile_key_invalid, acceptnewlines: true);
else 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()) if (playerKeyPair == null || playerKeyPair.NeedRefresh())
@ -720,7 +720,7 @@ namespace MinecraftClient
public static void DoExit(int exitcode = 0) public static void DoExit(int exitcode = 0)
{ {
WriteBackSettings(true); 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 (client != null) { client.Disconnect(); ConsoleIO.Reset(); }
if (offlinePrompt != null) { offlinePrompt.Item2.Cancel(); offlinePrompt.Item1.Join(); offlinePrompt = null; 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()) if (Handler.GetTerrainEnabled())
{ {
ConsoleIO.WriteLineFormatted(Translations.extra_terrainandmovement_disabled, acceptnewlines: true); ConsoleIO.WriteLineFormatted("§c" + Translations.extra_terrainandmovement_disabled, acceptnewlines: true);
Handler.SetTerrainEnabled(false); Handler.SetTerrainEnabled(false);
} }
if (handler.GetInventoryEnabled()) if (handler.GetInventoryEnabled())
{ {
ConsoleIO.WriteLineFormatted(Translations.extra_inventory_disabled, acceptnewlines: true); ConsoleIO.WriteLineFormatted("§c" + Translations.extra_inventory_disabled, acceptnewlines: true);
handler.SetInventoryEnabled(false); handler.SetInventoryEnabled(false);
} }
if (handler.GetEntityHandlingEnabled()) if (handler.GetEntityHandlingEnabled())
{ {
ConsoleIO.WriteLineFormatted(Translations.extra_entity_disabled, acceptnewlines: true); ConsoleIO.WriteLineFormatted("§c" + Translations.extra_entity_disabled, acceptnewlines: true);
handler.SetEntityHandlingEnabled(false); handler.SetEntityHandlingEnabled(false);
} }
} }
@ -494,15 +494,15 @@ namespace MinecraftClient.Protocol.Handlers
byte[] token = ReadNextByteArray(); byte[] token = ReadNextByteArray();
if (serverID == "-") 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) 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); return StartEncryption(uuid, username, sessionID, token, serverID, PublicServerkey, session);
} }
else else
{ {
ConsoleIO.WriteLineFormatted(Translations.error_invalid_response, acceptnewlines: true); ConsoleIO.WriteLineFormatted("§8" + Translations.error_invalid_response, acceptnewlines: true);
return false; return false;
} }
} }
@ -513,7 +513,7 @@ namespace MinecraftClient.Protocol.Handlers
byte[] secretKey = CryptoHandler.ClientAESPrivateKey ?? CryptoHandler.GenerateAESPrivateKey(); byte[] secretKey = CryptoHandler.ClientAESPrivateKey ?? CryptoHandler.GenerateAESPrivateKey();
if (Settings.Config.Logging.DebugMessages) if (Settings.Config.Logging.DebugMessages)
ConsoleIO.WriteLineFormatted(Translations.debug_crypto, acceptnewlines: true); ConsoleIO.WriteLineFormatted("§8" + Translations.debug_crypto, acceptnewlines: true);
if (serverIDhash != "-") if (serverIDhash != "-")
{ {
@ -578,7 +578,7 @@ namespace MinecraftClient.Protocol.Handlers
} }
else else
{ {
ConsoleIO.WriteLineFormatted(Translations.error_invalid_encrypt, acceptnewlines: true); ConsoleIO.WriteLineFormatted("§8" + Translations.error_invalid_encrypt, acceptnewlines: true);
return false; return false;
} }
} }

View file

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

View file

@ -131,7 +131,7 @@ namespace MinecraftClient.Protocol.Handlers
byte fmlProtocolVersion = dataTypes.ReadNextByte(packetData); byte fmlProtocolVersion = dataTypes.ReadNextByte(packetData);
if (Settings.Config.Logging.DebugMessages) 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) if (fmlProtocolVersion >= 1)
currentDimension = dataTypes.ReadNextInt(packetData); currentDimension = dataTypes.ReadNextInt(packetData);
@ -141,7 +141,7 @@ namespace MinecraftClient.Protocol.Handlers
// Then tell the server that we're running the same mods. // Then tell the server that we're running the same mods.
if (Settings.Config.Logging.DebugMessages) 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][]; byte[][] mods = new byte[forgeInfo.Mods.Count][];
for (int i = 0; i < forgeInfo.Mods.Count; i++) for (int i = 0; i < forgeInfo.Mods.Count; i++)
{ {
@ -161,7 +161,7 @@ namespace MinecraftClient.Protocol.Handlers
Thread.Sleep(2000); Thread.Sleep(2000);
if (Settings.Config.Logging.DebugMessages) 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 // Tell the server that yes, we are OK with the mods it has
// even though we don't actually care what 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); int registrySize = dataTypes.ReadNextVarInt(packetData);
if (Settings.Config.Logging.DebugMessages) 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; fmlHandshakeState = FMLHandshakeClientState.PENDINGCOMPLETE;
} }
@ -195,7 +195,7 @@ namespace MinecraftClient.Protocol.Handlers
string registryName = dataTypes.ReadNextString(packetData); string registryName = dataTypes.ReadNextString(packetData);
int registrySize = dataTypes.ReadNextVarInt(packetData); int registrySize = dataTypes.ReadNextVarInt(packetData);
if (Settings.Config.Logging.DebugMessages) 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) if (!hasNextRegistry)
fmlHandshakeState = FMLHandshakeClientState.PENDINGCOMPLETE; fmlHandshakeState = FMLHandshakeClientState.PENDINGCOMPLETE;
} }
@ -207,7 +207,7 @@ namespace MinecraftClient.Protocol.Handlers
if (discriminator != FMLHandshakeDiscriminator.HandshakeAck) if (discriminator != FMLHandshakeDiscriminator.HandshakeAck)
return false; return false;
if (Settings.Config.Logging.DebugMessages) 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, SendForgeHandshakePacket(FMLHandshakeDiscriminator.HandshakeAck,
new byte[] { (byte)FMLHandshakeClientState.PENDINGCOMPLETE }); new byte[] { (byte)FMLHandshakeClientState.PENDINGCOMPLETE });
fmlHandshakeState = FMLHandshakeClientState.COMPLETE; 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 // [1]: Version is usually set to "FML2" for FML stuff and "1" for mods
if (Settings.Config.Logging.DebugMessages) 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(); List<string> mods = new();
int modCount = dataTypes.ReadNextVarInt(packetData); 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. // 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) 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 // Packet ID 2: Client to Server Mod List
fmlResponsePacket.AddRange(dataTypes.GetVarInt(2)); fmlResponsePacket.AddRange(dataTypes.GetVarInt(2));
@ -371,7 +371,7 @@ namespace MinecraftClient.Protocol.Handlers
if (Settings.Config.Logging.DebugMessages) if (Settings.Config.Logging.DebugMessages)
{ {
string registryName = dataTypes.ReadNextString(packetData); 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)); fmlResponsePacket.AddRange(dataTypes.GetVarInt(99));
@ -390,7 +390,7 @@ namespace MinecraftClient.Protocol.Handlers
if (Settings.Config.Logging.DebugMessages) if (Settings.Config.Logging.DebugMessages)
{ {
string configName = dataTypes.ReadNextString(packetData); 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)); fmlResponsePacket.AddRange(dataTypes.GetVarInt(99));
@ -399,7 +399,7 @@ namespace MinecraftClient.Protocol.Handlers
default: default:
if (Settings.Config.Logging.DebugMessages) 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; break;
} }
@ -415,7 +415,7 @@ namespace MinecraftClient.Protocol.Handlers
} }
else if (Settings.Config.Logging.DebugMessages) 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; return false;
@ -504,10 +504,10 @@ namespace MinecraftClient.Protocol.Handlers
forgeInfo = new ForgeInfo(modData, fmlVersion); forgeInfo = new ForgeInfo(modData, fmlVersion);
if (forgeInfo.Mods.Any()) 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) 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) foreach (ForgeInfo.ForgeMod mod in forgeInfo.Mods)
ConsoleIO.WriteLineFormatted("§8 " + mod.ToString()); ConsoleIO.WriteLineFormatted("§8 " + mod.ToString());
} }
@ -515,7 +515,7 @@ namespace MinecraftClient.Protocol.Handlers
} }
else else
{ {
ConsoleIO.WriteLineFormatted(Translations.forge_no_mod, acceptnewlines: true); ConsoleIO.WriteLineFormatted("§8" + Translations.forge_no_mod, acceptnewlines: true);
forgeInfo = null; forgeInfo = null;
} }
} }

View file

@ -219,7 +219,7 @@ namespace MinecraftClient.Protocol
//File not found? Try downloading language file from Mojang's servers? //File not found? Try downloading language file from Mojang's servers?
if (!File.Exists(Language_File)) 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(); HttpClient httpClient = new();
try try
{ {
@ -233,7 +233,7 @@ namespace MinecraftClient.Protocol
string hash = tmp[1].Split('"')[0]; //Translations file identifier on Mojang's servers string hash = tmp[1].Split('"')[0]; //Translations file identifier on Mojang's servers
string translation_file_location = Settings.TranslationsFile_Website_Download + '/' + hash[..2] + '/' + hash; string translation_file_location = Settings.TranslationsFile_Website_Download + '/' + hash[..2] + '/' + hash;
if (Settings.Config.Logging.DebugMessages) 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); Task<string> fetch_file = httpClient.GetStringAsync(translation_file_location);
fetch_file.Wait(); 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); 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()); 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 catch
{ {
ConsoleIO.WriteLineFormatted(Translations.chat_fail, acceptnewlines: true); ConsoleIO.WriteLineFormatted("§8" + Translations.chat_fail, acceptnewlines: true);
} }
httpClient.Dispose(); httpClient.Dispose();
} }
@ -259,7 +259,7 @@ namespace MinecraftClient.Protocol
&& File.Exists(Settings.TranslationsFile_FromMCDir)) && File.Exists(Settings.TranslationsFile_FromMCDir))
{ {
Language_File = 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 //Load the external dictionnary of translation rules or display an error message
@ -278,11 +278,11 @@ namespace MinecraftClient.Protocol
} }
if (Settings.Config.Logging.DebugMessages) 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. 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) 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() private static void SaveToDisk()
{ {
if (Config.Logging.DebugMessages) 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() List<string> KeysCacheLines = new()
{ {
@ -192,7 +192,7 @@ namespace MinecraftClient.Protocol.Keys
} }
catch (IOException e) 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()) .ThenBy(record => Guid.NewGuid())
.First(); .First();
string target = result.Target.Value.Trim('.'); 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; domainVal = target;
portVal = result.Port; portVal = result.Port;
foundService = true; foundService = true;
@ -64,7 +64,7 @@ namespace MinecraftClient.Protocol
} }
catch (Exception e) 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)); }, TimeSpan.FromSeconds(Config.Main.Advanced.ResolveSrvRecords == MainConfigHealper.MainConfig.AdvancedConfig.ResolveSrvRecordType.fast ? 10 : 30));
} }
@ -96,7 +96,7 @@ namespace MinecraftClient.Protocol
success = true; success = true;
} }
else else
ConsoleIO.WriteLineFormatted(Translations.error_unexpect_response, acceptnewlines: true); ConsoleIO.WriteLineFormatted("§8" + Translations.error_unexpect_response, acceptnewlines: true);
} }
catch (Exception e) catch (Exception e)
{ {
@ -105,9 +105,9 @@ namespace MinecraftClient.Protocol
}, TimeSpan.FromSeconds(Config.Main.Advanced.ResolveSrvRecords == MainConfigHealper.MainConfig.AdvancedConfig.ResolveSrvRecordType.fast ? 10 : 30))) }, TimeSpan.FromSeconds(Config.Main.Advanced.ResolveSrvRecords == MainConfigHealper.MainConfig.AdvancedConfig.ResolveSrvRecordType.fast ? 10 : 30)))
{ {
if (protocolversion != 0 && protocolversion != protocolversionTmp) 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) 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) if (protocolversion == 0)
protocolversion = protocolversionTmp; protocolversion = protocolversionTmp;
forgeInfo = forgeInfoTmp; forgeInfo = forgeInfoTmp;
@ -115,7 +115,7 @@ namespace MinecraftClient.Protocol
} }
else else
{ {
ConsoleIO.WriteLineFormatted(Translations.error_connection_timeout, acceptnewlines: true); ConsoleIO.WriteLineFormatted("§8" + Translations.error_connection_timeout, acceptnewlines: true);
return false; return false;
} }
} }
@ -491,7 +491,7 @@ namespace MinecraftClient.Protocol
} }
else else
{ {
ConsoleIO.WriteLineFormatted(string.Format(Translations.error_http_code, code)); ConsoleIO.WriteLineFormatted("§8" + string.Format(Translations.error_http_code, code));
return LoginResult.OtherError; return LoginResult.OtherError;
} }
} }
@ -694,7 +694,7 @@ namespace MinecraftClient.Protocol
} }
else else
{ {
ConsoleIO.WriteLineFormatted(string.Format(Translations.error_auth, code)); ConsoleIO.WriteLineFormatted("§8" + string.Format(Translations.error_auth, code));
return LoginResult.OtherError; return LoginResult.OtherError;
} }
} }
@ -895,7 +895,7 @@ namespace MinecraftClient.Protocol
try try
{ {
if (Settings.Config.Logging.DebugMessages) 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); TcpClient client = ProxyHandler.NewTcpClient(host, 443, true);
SslStream stream = new(client.GetStream()); SslStream stream = new(client.GetStream());

View file

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