mirror of
https://github.com/MCCTeam/Minecraft-Console-Client
synced 2025-11-07 17:36:07 +00:00
merge brigadier-dev into milutinke:1.19.3
This commit is contained in:
commit
ba0d9ba3fc
139 changed files with 12057 additions and 3183 deletions
|
|
@ -6,7 +6,7 @@ using MinecraftClient.Protocol.Handlers;
|
|||
using MinecraftClient.Protocol.Message;
|
||||
using static MinecraftClient.Protocol.Message.LastSeenMessageList;
|
||||
|
||||
namespace MinecraftClient.Protocol.Keys
|
||||
namespace MinecraftClient.Protocol.ProfileKey
|
||||
{
|
||||
static class KeyUtils
|
||||
{
|
||||
|
|
@ -47,7 +47,7 @@ namespace MinecraftClient.Protocol.Keys
|
|||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
int code = (response == null) ? 0 : response.StatusCode;
|
||||
int code = response == null ? 0 : response.StatusCode;
|
||||
ConsoleIO.WriteLineFormatted("§cFetch profile key failed: HttpCode = " + code + ", Error = " + e.Message);
|
||||
if (Settings.Config.Logging.DebugMessages)
|
||||
{
|
||||
|
|
@ -57,7 +57,7 @@ namespace MinecraftClient.Protocol.Keys
|
|||
}
|
||||
}
|
||||
|
||||
public static byte[] DecodePemKey(String key, String prefix, String suffix)
|
||||
public static byte[] DecodePemKey(string key, string prefix, string suffix)
|
||||
{
|
||||
int i = key.IndexOf(prefix);
|
||||
if (i != -1)
|
||||
|
|
@ -66,8 +66,8 @@ namespace MinecraftClient.Protocol.Keys
|
|||
int j = key.IndexOf(suffix, i);
|
||||
key = key[i..j];
|
||||
}
|
||||
key = key.Replace("\r", String.Empty);
|
||||
key = key.Replace("\n", String.Empty);
|
||||
key = key.Replace("\r", string.Empty);
|
||||
key = key.Replace("\n", string.Empty);
|
||||
return Convert.FromBase64String(key);
|
||||
}
|
||||
|
||||
|
|
@ -198,11 +198,11 @@ namespace MinecraftClient.Protocol.Keys
|
|||
char c = src[i];
|
||||
bool needEscape = c < 32 || c == '"' || c == '\\';
|
||||
// Broken lead surrogate
|
||||
needEscape = needEscape || (c >= '\uD800' && c <= '\uDBFF' &&
|
||||
(i == src.Length - 1 || src[i + 1] < '\uDC00' || src[i + 1] > '\uDFFF'));
|
||||
needEscape = needEscape || c >= '\uD800' && c <= '\uDBFF' &&
|
||||
(i == src.Length - 1 || src[i + 1] < '\uDC00' || src[i + 1] > '\uDFFF');
|
||||
// Broken tail surrogate
|
||||
needEscape = needEscape || (c >= '\uDC00' && c <= '\uDFFF' &&
|
||||
(i == 0 || src[i - 1] < '\uD800' || src[i - 1] > '\uDBFF'));
|
||||
needEscape = needEscape || c >= '\uDC00' && c <= '\uDFFF' &&
|
||||
(i == 0 || src[i - 1] < '\uD800' || src[i - 1] > '\uDBFF');
|
||||
// To produce valid JavaScript
|
||||
needEscape = needEscape || c == '\u2028' || c == '\u2029';
|
||||
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@ using System.Timers;
|
|||
using static MinecraftClient.Settings;
|
||||
using static MinecraftClient.Settings.MainConfigHealper.MainConfig.AdvancedConfig;
|
||||
|
||||
namespace MinecraftClient.Protocol.Keys
|
||||
namespace MinecraftClient.Protocol.ProfileKey
|
||||
{
|
||||
/// <summary>
|
||||
/// Handle keys caching and storage.
|
||||
|
|
@ -115,7 +115,7 @@ namespace MinecraftClient.Protocol.Keys
|
|||
//User-editable keys cache file in text format
|
||||
if (File.Exists(KeysCacheFilePlaintext))
|
||||
{
|
||||
if (Settings.Config.Logging.DebugMessages)
|
||||
if (Config.Logging.DebugMessages)
|
||||
ConsoleIO.WriteLineFormatted(string.Format(Translations.cache_loading_keys, KeysCacheFilePlaintext));
|
||||
|
||||
try
|
||||
|
|
@ -134,27 +134,27 @@ namespace MinecraftClient.Protocol.Keys
|
|||
{
|
||||
PlayerKeyPair playerKeyPair = PlayerKeyPair.FromString(value);
|
||||
keys[login] = playerKeyPair;
|
||||
if (Settings.Config.Logging.DebugMessages)
|
||||
if (Config.Logging.DebugMessages)
|
||||
ConsoleIO.WriteLineFormatted(string.Format(Translations.cache_loaded_keys, playerKeyPair.ExpiresAt.ToString()));
|
||||
}
|
||||
catch (InvalidDataException e)
|
||||
{
|
||||
if (Settings.Config.Logging.DebugMessages)
|
||||
if (Config.Logging.DebugMessages)
|
||||
ConsoleIO.WriteLineFormatted(string.Format(Translations.cache_ignore_string_keys, value, e.Message));
|
||||
}
|
||||
catch (FormatException e)
|
||||
{
|
||||
if (Settings.Config.Logging.DebugMessages)
|
||||
if (Config.Logging.DebugMessages)
|
||||
ConsoleIO.WriteLineFormatted(string.Format(Translations.cache_ignore_string_keys, value, e.Message));
|
||||
}
|
||||
catch (ArgumentNullException e)
|
||||
{
|
||||
if (Settings.Config.Logging.DebugMessages)
|
||||
if (Config.Logging.DebugMessages)
|
||||
ConsoleIO.WriteLineFormatted(string.Format(Translations.cache_ignore_string_keys, value, e.Message));
|
||||
|
||||
}
|
||||
}
|
||||
else if (Settings.Config.Logging.DebugMessages)
|
||||
else if (Config.Logging.DebugMessages)
|
||||
{
|
||||
ConsoleIO.WriteLineFormatted(string.Format(Translations.cache_ignore_line_keys, line));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
|
||||
namespace MinecraftClient.Protocol.Keys
|
||||
namespace MinecraftClient.Protocol.ProfileKey
|
||||
{
|
||||
public class PlayerKeyPair
|
||||
{
|
||||
|
|
@ -74,17 +74,17 @@ namespace MinecraftClient.Protocol.Keys
|
|||
List<string> datas = new();
|
||||
datas.Add(Convert.ToBase64String(PublicKey.Key));
|
||||
if (PublicKey.Signature == null)
|
||||
datas.Add(String.Empty);
|
||||
datas.Add(string.Empty);
|
||||
else
|
||||
datas.Add(Convert.ToBase64String(PublicKey.Signature));
|
||||
if (PublicKey.SignatureV2 == null)
|
||||
datas.Add(String.Empty);
|
||||
datas.Add(string.Empty);
|
||||
else
|
||||
datas.Add(Convert.ToBase64String(PublicKey.SignatureV2));
|
||||
datas.Add(Convert.ToBase64String(PrivateKey.Key));
|
||||
datas.Add(ExpiresAt.ToString(DataTimeFormat));
|
||||
datas.Add(RefreshedAfter.ToString(DataTimeFormat));
|
||||
return String.Join(",", datas.ToArray());
|
||||
return string.Join(",", datas.ToArray());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@ using System.Security.Cryptography;
|
|||
using MinecraftClient.Protocol.Message;
|
||||
using static MinecraftClient.Protocol.Message.LastSeenMessageList;
|
||||
|
||||
namespace MinecraftClient.Protocol.Keys
|
||||
namespace MinecraftClient.Protocol.ProfileKey
|
||||
{
|
||||
public class PrivateKey
|
||||
{
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
using System.Security.Cryptography;
|
||||
using MinecraftClient.Protocol.Message;
|
||||
|
||||
namespace MinecraftClient.Protocol.Keys
|
||||
namespace MinecraftClient.Protocol.ProfileKey
|
||||
{
|
||||
public class PublicKey
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue