From 700d345cef56b2e32a9b7d267b8cd6bb881588aa Mon Sep 17 00:00:00 2001 From: ORelio Date: Thu, 15 Aug 2013 18:04:29 +0200 Subject: [PATCH] Added BasicIO mode MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit If "BasicIO" is passed as last argument, Basic IO will be enabled. - Basic input/output : disable the advanced I/O class from MCC 1.3+ - Do not print colors, output messages directly with §c color tags This allows an external GUI to manage input/output instead of MCC. http://www.minecraftforum.net/topic/1314800-/page__st__180#entry23903618 --- MinecraftClient/ConsoleIO.cs | 3 +++ MinecraftClient/MinecraftCom.cs | 1 + MinecraftClient/Program.cs | 7 +++++++ 3 files changed, 11 insertions(+) diff --git a/MinecraftClient/ConsoleIO.cs b/MinecraftClient/ConsoleIO.cs index 1eb9c716..6cabce76 100644 --- a/MinecraftClient/ConsoleIO.cs +++ b/MinecraftClient/ConsoleIO.cs @@ -14,6 +14,7 @@ namespace MinecraftClient { public static void Reset() { if (reading) { reading = false; Console.Write("\b \b"); } } public static void SetAutoCompleteEngine(IAutoComplete engine) { autocomplete_engine = engine; } + public static bool basicIO = false; private static IAutoComplete autocomplete_engine; private static LinkedList previous = new LinkedList(); private static string buffer = ""; @@ -25,6 +26,7 @@ namespace MinecraftClient #region Read User Input public static string ReadLine() { + if (basicIO) { return Console.ReadLine(); } ConsoleKeyInfo k = new ConsoleKeyInfo(); Console.Write('>'); reading = true; @@ -120,6 +122,7 @@ namespace MinecraftClient #region Console Output public static void Write(string text) { + if (basicIO) { Console.Write(text); return; } while (reading_lock) { } writing_lock = true; if (reading) diff --git a/MinecraftClient/MinecraftCom.cs b/MinecraftClient/MinecraftCom.cs index eba92574..0eff1752 100644 --- a/MinecraftClient/MinecraftCom.cs +++ b/MinecraftClient/MinecraftCom.cs @@ -467,6 +467,7 @@ namespace MinecraftClient 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++) diff --git a/MinecraftClient/Program.cs b/MinecraftClient/Program.cs index b7c456f3..bab91b2d 100644 --- a/MinecraftClient/Program.cs +++ b/MinecraftClient/Program.cs @@ -25,6 +25,13 @@ namespace MinecraftClient { Console.WriteLine("Console Client for MC 1.4.6 to 1.6.2 - v" + Version + " - By ORelio (or3L1o@live.fr)"); + //Basic Input/Output ? + if (args.Length >= 1 && args[args.Length - 1] == "BasicIO") + { + ConsoleIO.basicIO = true; + args = args.Where(o => !Object.ReferenceEquals(o, args[args.Length - 1])).ToArray(); + } + //Processing Command-line arguments or Config File if (args.Length == 1 && System.IO.File.Exists(args[0]))