From ea9e6e8187208136a9232f67e221a0e89f91d47f Mon Sep 17 00:00:00 2001 From: Vitalij Date: Sun, 19 Jan 2014 16:25:19 +0400 Subject: [PATCH] Fixed output for GUI. --- MinecraftClient/MinecraftCom.cs | 37 +++++++++++++++++++++++++-------- 1 file changed, 28 insertions(+), 9 deletions(-) diff --git a/MinecraftClient/MinecraftCom.cs b/MinecraftClient/MinecraftCom.cs index 12cbb70836..6331a175b8 100644 --- a/MinecraftClient/MinecraftCom.cs +++ b/MinecraftClient/MinecraftCom.cs @@ -287,23 +287,42 @@ private static void printstring(string str, bool acceptnewlines) if (!String.IsNullOrEmpty(str)) { if (!acceptnewlines) { str = str.Replace('\n', ' '); } - if (ConsoleIO.basicIO) { ConsoleIO.WriteLine(str); return; } - string[] subs = str.Split(new char[] { '§' }); - if (subs[0].Length > 0) { ConsoleIO.Write(subs[0]); } - for (int i = 1; i < subs.Length; i++) + if (ConsoleIO.basicIO) { - if (subs[i].Length > 0) + string line = ""; + string[] subs = str.Split(new char[] {'§'}); + if (subs[0].Length > 0) { line += subs[0]; } + for (int i = 1; i < subs.Length; i++) { - setcolor(subs[i][0]); if (subs[i].Length > 1) { - ConsoleIO.Write(subs[i].Substring(1, subs[i].Length - 1)); + line += (subs[i].Substring(1, subs[i].Length - 1)); + } + + } + + ConsoleIO.WriteLine(line); return; + } + else + { + string[] subs = str.Split(new char[] {'§'}); + if (subs[0].Length > 0) { ConsoleIO.Write(subs[0]); } + for (int i = 1; i < subs.Length; i++) + { + if (subs[i].Length > 0) + { + setcolor(subs[i][0]); + if (subs[i].Length > 1) + { + ConsoleIO.Write(subs[i].Substring(1, subs[i].Length - 1)); + } } } + ConsoleIO.Write('\n'); } - ConsoleIO.Write('\n'); + Console.ForegroundColor = ConsoleColor.Gray; } - Console.ForegroundColor = ConsoleColor.Gray; + } private bool autocomplete_received = false;