Add submodule MinecraftProtocolLibrary

This commit is contained in:
BruceChen 2022-12-23 00:50:20 +08:00
parent 87026e1bfb
commit 3f1de66af3
62 changed files with 1093 additions and 450 deletions

View file

@ -56,7 +56,6 @@ namespace MinecraftClient
private static bool useMcVersionOnce = false;
private static string settingsIniPath = "MinecraftClient.ini";
private static int CurrentThreadId;
private static bool RestartKeepSettings = false;
private static int RestartAfter = -1, Exitcode = 0;
@ -93,6 +92,8 @@ namespace MinecraftClient
if (BuildInfo != null)
ConsoleIO.WriteLineFormatted("§8" + BuildInfo);
ConsoleIO.WriteLine("\u001b[33m\u001b[46m▀\u001b[0m");
string? specifiedSettingFile = null;
if (args.Length >= 1 && File.Exists(args[0]) && Settings.ToLowerIfNeed(Path.GetExtension(args[0])) == ".ini")
{
@ -194,8 +195,6 @@ namespace MinecraftClient
startupargs = args;
CurrentThreadId = Environment.CurrentManagedThreadId;
// Check for updates
AsyncTaskHandler.CheckUpdate = Task.Run(async () =>
{
@ -419,7 +418,6 @@ namespace MinecraftClient
}
else if (!loadSucceed)
{
ConsoleInteractive.ConsoleReader.StopReadThread();
while (true)
{
ConsoleIO.WriteLine(string.Empty);
@ -724,6 +722,7 @@ namespace MinecraftClient
var getServerInfoTask = GetServerInfoAsync(loginHttpClient, loginTask);
var refreshPlayerKeyTask = RefreshPlayerKeyPair(loginHttpClient, loginTask);
// Todo: Detailed status display of login steps.
(result, session, playerKeyPair) = await loginTask;
if (result == ProtocolHandler.LoginResult.Success && session != null)
{
@ -808,11 +807,6 @@ namespace MinecraftClient
}
}
public static int GetMainThreadId()
{
return CurrentThreadId;
}
/// <summary>
/// Reloads settings
/// </summary>
@ -988,7 +982,7 @@ namespace MinecraftClient
public static Type[] GetTypesInNamespace(string nameSpace, Assembly? assembly = null)
{
if (assembly == null) { assembly = Assembly.GetExecutingAssembly(); }
return assembly.GetTypes().Where(t => String.Equals(t.Namespace, nameSpace, StringComparison.Ordinal)).ToArray();
return assembly.GetTypes().Where(t => string.Equals(t.Namespace, nameSpace, StringComparison.Ordinal)).ToArray();
}
/// <summary>
@ -998,7 +992,7 @@ namespace MinecraftClient
{
if (typeof(Program)
.Assembly
.GetCustomAttributes(typeof(System.Reflection.AssemblyConfigurationAttribute), false)
.GetCustomAttributes(typeof(AssemblyConfigurationAttribute), false)
.FirstOrDefault() is AssemblyConfigurationAttribute attribute)
BuildInfo = attribute.Configuration;
}