mirror of
https://github.com/MCCTeam/Minecraft-Console-Client
synced 2025-11-07 17:36:07 +00:00
Merge branch 'Indev' of https://github.com/ORelio/Minecraft-Console-Client into Indev
This commit is contained in:
commit
c1d2cbd84c
2 changed files with 14 additions and 14 deletions
|
|
@ -45,22 +45,18 @@ namespace MinecraftClient
|
|||
|
||||
public static string ReadPassword()
|
||||
{
|
||||
string password = "";
|
||||
ConsoleKeyInfo k = new ConsoleKeyInfo();
|
||||
while (k.Key != ConsoleKey.Enter)
|
||||
StringBuilder password = new StringBuilder();
|
||||
|
||||
ConsoleKeyInfo k;
|
||||
while ((k = Console.ReadKey(true)).Key != ConsoleKey.Enter)
|
||||
{
|
||||
k = Console.ReadKey(true);
|
||||
switch (k.Key)
|
||||
{
|
||||
case ConsoleKey.Enter:
|
||||
Console.Write('\n');
|
||||
return password;
|
||||
|
||||
case ConsoleKey.Backspace:
|
||||
if (password.Length > 0)
|
||||
{
|
||||
Console.Write("\b \b");
|
||||
password = password.Substring(0, password.Length - 1);
|
||||
password.Remove(password.Length - 1, 1);
|
||||
}
|
||||
break;
|
||||
|
||||
|
|
@ -79,12 +75,14 @@ namespace MinecraftClient
|
|||
if (k.KeyChar != 0)
|
||||
{
|
||||
Console.Write('*');
|
||||
password += k.KeyChar;
|
||||
password.Append(k.KeyChar);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
return password;
|
||||
|
||||
Console.WriteLine();
|
||||
return password.ToString();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
|
|
|||
|
|
@ -285,16 +285,18 @@ namespace MinecraftClient.Protocol
|
|||
StringBuilder result = new StringBuilder();
|
||||
foreach (char c in text)
|
||||
{
|
||||
if (char.IsLetterOrDigit(c))
|
||||
if ((c >= '0' && c <= '9') ||
|
||||
(c >= 'a' && c <= 'z') ||
|
||||
(c >= 'A' && c <= 'Z'))
|
||||
{
|
||||
result.Append(c);
|
||||
}
|
||||
else
|
||||
{
|
||||
result.Append("\\u");
|
||||
result.Append(((int)c).ToString("x4"));
|
||||
result.AppendFormat(@"\u{0:x4}", (int)c);
|
||||
}
|
||||
}
|
||||
|
||||
return result.ToString();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue