diff --git a/MinecraftClient/ConsoleIO.cs b/MinecraftClient/ConsoleIO.cs index b720c088..b59e2031 100644 --- a/MinecraftClient/ConsoleIO.cs +++ b/MinecraftClient/ConsoleIO.cs @@ -11,7 +11,6 @@ namespace MinecraftClient /// Allows simultaneous console input and output without breaking user input /// (Without having this annoying behaviour : User inp[Some Console output]ut) /// - public static class ConsoleIO { public static bool basicIO = false; @@ -26,7 +25,6 @@ namespace MinecraftClient /// /// Reset the IO mechanism and clear all buffers /// - public static void Reset() { lock (io_lock) @@ -43,7 +41,6 @@ namespace MinecraftClient /// /// Read a password from the standard input /// - public static string ReadPassword() { StringBuilder password = new StringBuilder(); @@ -89,7 +86,6 @@ namespace MinecraftClient /// /// Read a line from the standard input /// - public static string ReadLine() { if (basicIO) { return Console.ReadLine(); } @@ -203,11 +199,23 @@ namespace MinecraftClient return buffer + buffer2; } } - + + /// + /// Debug routine + /// + public static void DebugReadInput() + { + ConsoleKeyInfo k = new ConsoleKeyInfo(); + while (true) + { + k = Console.ReadKey(true); + Console.WriteLine("Key: {0}\tChar: {1}\tModifiers: {2}", k.Key, k.KeyChar, k.Modifiers); + } + } + /// /// Write a string to the standard output, without newline character /// - public static void Write(string text) { if (!basicIO) @@ -256,7 +264,6 @@ namespace MinecraftClient /// /// Write a string to the standard output with a trailing newline /// - public static void WriteLine(string line) { Write(line + '\n'); @@ -265,7 +272,6 @@ namespace MinecraftClient /// /// Write a single character to the standard output /// - public static void Write(char c) { Write("" + c); @@ -276,7 +282,6 @@ namespace MinecraftClient /// /// String to write /// If false, space are printed instead of newlines - public static void WriteLineFormatted(string str, bool acceptnewlines = true) { if (basicIO) { Console.WriteLine(str); return; } @@ -331,7 +336,6 @@ namespace MinecraftClient /// Write a Minecraft Console Client Log line /// /// Text of the log line - public static void WriteLogLine(string text) { WriteLineFormatted("ยง8[MCC] " + text); @@ -438,7 +442,6 @@ namespace MinecraftClient /// Set an auto-completion engine for TAB autocompletion /// /// Engine implementing the IAutoComplete interface - public static void SetAutoCompleteEngine(IAutoComplete engine) { autocomplete_engine = engine; @@ -450,7 +453,6 @@ namespace MinecraftClient /// Interface for TAB autocompletion /// Allows to use any object which has an AutoComplete() method using the IAutocomplete interface /// - public interface IAutoComplete { IEnumerable AutoComplete(string BehindCursor); diff --git a/MinecraftClient/Program.cs b/MinecraftClient/Program.cs index 74775c32..38f511b9 100644 --- a/MinecraftClient/Program.cs +++ b/MinecraftClient/Program.cs @@ -34,6 +34,13 @@ namespace MinecraftClient { Console.WriteLine("Console Client for MC {0} to {1} - v{2} - By ORelio & Contributors", MCLowestVersion, MCHighestVersion, Version); + //Debug input ? + if (args.Length == 1 && args[0] == "--keyboard-debug") + { + Console.WriteLine("Keyboard debug mode: Press any key to display info"); + ConsoleIO.DebugReadInput(); + } + //Basic Input/Output ? if (args.Length >= 1 && args[args.Length - 1] == "BasicIO") {