mirror of
https://github.com/MCCTeam/Minecraft-Console-Client
synced 2025-10-14 21:22:49 +00:00
Strip Minecraft Color Codes (§) in BasicIO-NoColor mode (#995)
Strip Minecraft color codes and formatting (§) if in BasicIO mode by using BasicIO-NoColor.
This commit is contained in:
parent
43c2b4b73b
commit
a018304f99
4 changed files with 16 additions and 2 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
|
@ -8,3 +8,4 @@
|
||||||
/Other/
|
/Other/
|
||||||
/.vs/
|
/.vs/
|
||||||
SessionCache.ini
|
SessionCache.ini
|
||||||
|
.*
|
||||||
|
|
|
||||||
|
|
@ -240,7 +240,7 @@ namespace MinecraftClient
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Remove color codes ("§c") from a text message received from the server
|
/// Remove color codes ("§c") from a text message received from the server
|
||||||
/// </summary>
|
/// </summary>
|
||||||
protected static string GetVerbatim(string text)
|
public static string GetVerbatim(string text)
|
||||||
{
|
{
|
||||||
if ( String.IsNullOrEmpty(text) )
|
if ( String.IsNullOrEmpty(text) )
|
||||||
return String.Empty;
|
return String.Empty;
|
||||||
|
|
|
||||||
|
|
@ -55,6 +55,11 @@ namespace MinecraftClient
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public static bool BasicIO = false;
|
public static bool BasicIO = false;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Determines whether not to print color codes in BasicIO mode.
|
||||||
|
/// </summary>
|
||||||
|
public static bool BasicIO_NoColor = false;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Determine whether WriteLineFormatted() should prepend lines with timestamps by default.
|
/// Determine whether WriteLineFormatted() should prepend lines with timestamps by default.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
@ -336,6 +341,10 @@ namespace MinecraftClient
|
||||||
}
|
}
|
||||||
if (BasicIO)
|
if (BasicIO)
|
||||||
{
|
{
|
||||||
|
if (BasicIO_NoColor)
|
||||||
|
{
|
||||||
|
str = ChatBot.GetVerbatim(str);
|
||||||
|
}
|
||||||
Console.WriteLine(str);
|
Console.WriteLine(str);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -59,8 +59,12 @@ namespace MinecraftClient
|
||||||
|
|
||||||
//Setup ConsoleIO
|
//Setup ConsoleIO
|
||||||
ConsoleIO.LogPrefix = "§8[MCC] ";
|
ConsoleIO.LogPrefix = "§8[MCC] ";
|
||||||
if (args.Length >= 1 && args[args.Length - 1] == "BasicIO")
|
if (args.Length >= 1 && args[args.Length - 1] == "BasicIO" || args.Length >= 1 && args[args.Length - 1] == "BasicIO-NoColor")
|
||||||
{
|
{
|
||||||
|
if (args.Length >= 1 && args[args.Length - 1] == "BasicIO-NoColor")
|
||||||
|
{
|
||||||
|
ConsoleIO.BasicIO_NoColor = true;
|
||||||
|
}
|
||||||
ConsoleIO.BasicIO = true;
|
ConsoleIO.BasicIO = true;
|
||||||
args = args.Where(o => !Object.ReferenceEquals(o, args[args.Length - 1])).ToArray();
|
args = args.Where(o => !Object.ReferenceEquals(o, args[args.Length - 1])).ToArray();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue