mirror of
https://github.com/MCCTeam/Minecraft-Console-Client
synced 2025-10-14 21:22:49 +00:00
App refactoring almost done
- Created specific namespaces and folders for each app brick - Added proxy support using Starksoft's Biko Library - App bricks: Main, ChatBots, Crypto, Protocol, Proxy - Each class is now in its own file (Aes streams, chatbots) - Used "Bridge" design pattern for Crypto, Protocol, Proxy - Added back support for Minecraft 1.4.6 to 1.6.4 (MCC 1.6.2) - Need to fully re-test everything and fix bugs - To Fix : Server pinging is slow on SpigotMC - To Do : Add Minecraft 1.2.5 (MCC 1.3) and maybe 1.3 to 1.4.5
This commit is contained in:
parent
9be1d99ca0
commit
d2ec2f48b7
43 changed files with 6039 additions and 2178 deletions
|
|
@ -25,7 +25,10 @@ namespace MinecraftClient
|
|||
private static bool reading_lock = false;
|
||||
private static bool writing_lock = false;
|
||||
|
||||
#region Read User Input
|
||||
/// <summary>
|
||||
/// Read a password from the standard input
|
||||
/// </summary>
|
||||
|
||||
public static string ReadPassword()
|
||||
{
|
||||
string password = "";
|
||||
|
|
@ -71,6 +74,10 @@ namespace MinecraftClient
|
|||
return password;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Read a line from the standard input
|
||||
/// </summary>
|
||||
|
||||
public static string ReadLine()
|
||||
{
|
||||
if (basicIO) { return Console.ReadLine(); }
|
||||
|
|
@ -174,9 +181,11 @@ namespace MinecraftClient
|
|||
previous.AddLast(buffer + buffer2);
|
||||
return buffer + buffer2;
|
||||
}
|
||||
#endregion
|
||||
|
||||
/// <summary>
|
||||
/// Write a string to the standard output, without newline character
|
||||
/// </summary>
|
||||
|
||||
#region Console Output
|
||||
public static void Write(string text)
|
||||
{
|
||||
if (basicIO) { Console.Write(text); return; }
|
||||
|
|
@ -216,16 +225,79 @@ namespace MinecraftClient
|
|||
writing_lock = false;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Write a string to the standard output with a trailing newline
|
||||
/// </summary>
|
||||
|
||||
public static void WriteLine(string line)
|
||||
{
|
||||
Write(line + '\n');
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Write a single character to the standard output
|
||||
/// </summary>
|
||||
|
||||
public static void Write(char c)
|
||||
{
|
||||
Write("" + c);
|
||||
}
|
||||
#endregion
|
||||
|
||||
/// <summary>
|
||||
/// Write a Minecraft-Formatted string to the standard output, using §c color codes
|
||||
/// </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)
|
||||
{
|
||||
if (basicIO) { Console.WriteLine(str); return; }
|
||||
if (!String.IsNullOrEmpty(str))
|
||||
{
|
||||
if (Settings.chatTimeStamps)
|
||||
{
|
||||
int hour = DateTime.Now.Hour, minute = DateTime.Now.Minute, second = DateTime.Now.Second;
|
||||
ConsoleIO.Write(hour.ToString("00") + ':' + minute.ToString("00") + ':' + second.ToString("00") + ' ');
|
||||
}
|
||||
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 (subs[i].Length > 0)
|
||||
{
|
||||
switch (subs[i][0])
|
||||
{
|
||||
case '0': Console.ForegroundColor = ConsoleColor.Gray; break; //Should be Black but Black is non-readable on a black background
|
||||
case '1': Console.ForegroundColor = ConsoleColor.DarkBlue; break;
|
||||
case '2': Console.ForegroundColor = ConsoleColor.DarkGreen; break;
|
||||
case '3': Console.ForegroundColor = ConsoleColor.DarkCyan; break;
|
||||
case '4': Console.ForegroundColor = ConsoleColor.DarkRed; break;
|
||||
case '5': Console.ForegroundColor = ConsoleColor.DarkMagenta; break;
|
||||
case '6': Console.ForegroundColor = ConsoleColor.DarkYellow; break;
|
||||
case '7': Console.ForegroundColor = ConsoleColor.Gray; break;
|
||||
case '8': Console.ForegroundColor = ConsoleColor.DarkGray; break;
|
||||
case '9': Console.ForegroundColor = ConsoleColor.Blue; break;
|
||||
case 'a': Console.ForegroundColor = ConsoleColor.Green; break;
|
||||
case 'b': Console.ForegroundColor = ConsoleColor.Cyan; break;
|
||||
case 'c': Console.ForegroundColor = ConsoleColor.Red; break;
|
||||
case 'd': Console.ForegroundColor = ConsoleColor.Magenta; break;
|
||||
case 'e': Console.ForegroundColor = ConsoleColor.Yellow; break;
|
||||
case 'f': Console.ForegroundColor = ConsoleColor.White; break;
|
||||
case 'r': Console.ForegroundColor = ConsoleColor.White; break;
|
||||
}
|
||||
|
||||
if (subs[i].Length > 1)
|
||||
{
|
||||
ConsoleIO.Write(subs[i].Substring(1, subs[i].Length - 1));
|
||||
}
|
||||
}
|
||||
}
|
||||
ConsoleIO.Write('\n');
|
||||
}
|
||||
Console.ForegroundColor = ConsoleColor.Gray;
|
||||
}
|
||||
|
||||
#region Subfunctions
|
||||
private static void ClearLineAndBuffer()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue