mirror of
https://github.com/MCCTeam/Minecraft-Console-Client
synced 2025-11-07 17:36:07 +00:00
Add keyboard debug routine
This commit is contained in:
parent
9f1ef83680
commit
7c9c12bee7
2 changed files with 21 additions and 12 deletions
|
|
@ -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)
|
||||
/// </summary>
|
||||
|
||||
public static class ConsoleIO
|
||||
{
|
||||
public static bool basicIO = false;
|
||||
|
|
@ -26,7 +25,6 @@ namespace MinecraftClient
|
|||
/// <summary>
|
||||
/// Reset the IO mechanism and clear all buffers
|
||||
/// </summary>
|
||||
|
||||
public static void Reset()
|
||||
{
|
||||
lock (io_lock)
|
||||
|
|
@ -43,7 +41,6 @@ namespace MinecraftClient
|
|||
/// <summary>
|
||||
/// Read a password from the standard input
|
||||
/// </summary>
|
||||
|
||||
public static string ReadPassword()
|
||||
{
|
||||
StringBuilder password = new StringBuilder();
|
||||
|
|
@ -89,7 +86,6 @@ namespace MinecraftClient
|
|||
/// <summary>
|
||||
/// Read a line from the standard input
|
||||
/// </summary>
|
||||
|
||||
public static string ReadLine()
|
||||
{
|
||||
if (basicIO) { return Console.ReadLine(); }
|
||||
|
|
@ -204,10 +200,22 @@ namespace MinecraftClient
|
|||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Debug routine
|
||||
/// </summary>
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Write a string to the standard output, without newline character
|
||||
/// </summary>
|
||||
|
||||
public static void Write(string text)
|
||||
{
|
||||
if (!basicIO)
|
||||
|
|
@ -256,7 +264,6 @@ namespace MinecraftClient
|
|||
/// <summary>
|
||||
/// Write a string to the standard output with a trailing newline
|
||||
/// </summary>
|
||||
|
||||
public static void WriteLine(string line)
|
||||
{
|
||||
Write(line + '\n');
|
||||
|
|
@ -265,7 +272,6 @@ namespace MinecraftClient
|
|||
/// <summary>
|
||||
/// Write a single character to the standard output
|
||||
/// </summary>
|
||||
|
||||
public static void Write(char c)
|
||||
{
|
||||
Write("" + c);
|
||||
|
|
@ -276,7 +282,6 @@ namespace MinecraftClient
|
|||
/// </summary>
|
||||
/// <param name="str">String to write</param>
|
||||
/// <param name="acceptnewlines">If false, space are printed instead of newlines</param>
|
||||
|
||||
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
|
||||
/// </summary>
|
||||
/// <param name="text">Text of the log line</param>
|
||||
|
||||
public static void WriteLogLine(string text)
|
||||
{
|
||||
WriteLineFormatted("§8[MCC] " + text);
|
||||
|
|
@ -438,7 +442,6 @@ namespace MinecraftClient
|
|||
/// Set an auto-completion engine for TAB autocompletion
|
||||
/// </summary>
|
||||
/// <param name="engine">Engine implementing the IAutoComplete interface</param>
|
||||
|
||||
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
|
||||
/// </summary>
|
||||
|
||||
public interface IAutoComplete
|
||||
{
|
||||
IEnumerable<string> AutoComplete(string BehindCursor);
|
||||
|
|
|
|||
|
|
@ -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")
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue