ConsoleIO: fix timestamp & BasicIO-NoColor (#2076)

* ConsoleIO: correct BasicIO-NoColor handling

We need color code stripped string in place of original string, not
appending to it

* ConsoleIO: fix timestamp order

Timestamp should come before the string, not after.

* ConsoleIO: check BasicIO-NoColor only when BasicIO
This commit is contained in:
xdavidwu 2022-08-16 00:17:30 +08:00 committed by GitHub
parent a8bbb1ac76
commit 78dd3ea17e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -123,14 +123,6 @@ namespace MinecraftClient
if (!String.IsNullOrEmpty(str))
{
if (!acceptnewlines)
{
output.Append(str.Replace('\n', ' '));
}
else
{
output.Append(str);
}
if (displayTimestamp == null)
{
displayTimestamp = EnableTimestamps;
@ -140,15 +132,24 @@ namespace MinecraftClient
int hour = DateTime.Now.Hour, minute = DateTime.Now.Minute, second = DateTime.Now.Second;
output.Append(String.Format("{0}:{1}:{2} ", hour.ToString("00"), minute.ToString("00"), second.ToString("00")));
}
if (!acceptnewlines)
{
str = str.Replace('\n', ' ');
}
if (BasicIO)
{
if (BasicIO_NoColor)
{
output.Append(ChatBot.GetVerbatim(str));
}
else
{
output.Append(str);
}
Console.WriteLine(output.ToString());
return;
}
output.Append(str);
ConsoleInteractive.ConsoleWriter.WriteLineFormatted(output.ToString());
}
}