From 5b26183c3432b769f1ca457419c8edfa645099ba Mon Sep 17 00:00:00 2001 From: Timerix22 Date: Sun, 7 Jan 2024 00:43:50 +0600 Subject: [PATCH] launcher TargetFramework changed to net48 and added Costura.Fody --- minecraft-launcher-client/FodyWeavers.xml | 4 + minecraft-launcher-client/FodyWeavers.xsd | 141 ++++++++++++++++++ minecraft-launcher-client/Launcher.cs | 5 +- .../launcher-client.csproj | 14 +- minecraft-launcher-client/publish.bat | 12 +- 5 files changed, 162 insertions(+), 14 deletions(-) create mode 100644 minecraft-launcher-client/FodyWeavers.xml create mode 100644 minecraft-launcher-client/FodyWeavers.xsd diff --git a/minecraft-launcher-client/FodyWeavers.xml b/minecraft-launcher-client/FodyWeavers.xml new file mode 100644 index 0000000..f00ec6d --- /dev/null +++ b/minecraft-launcher-client/FodyWeavers.xml @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/minecraft-launcher-client/FodyWeavers.xsd b/minecraft-launcher-client/FodyWeavers.xsd new file mode 100644 index 0000000..ff119f7 --- /dev/null +++ b/minecraft-launcher-client/FodyWeavers.xsd @@ -0,0 +1,141 @@ + + + + + + + + + + + + A list of assembly names to exclude from the default action of "embed all Copy Local references", delimited with line breaks + + + + + A list of assembly names to include from the default action of "embed all Copy Local references", delimited with line breaks. + + + + + A list of runtime assembly names to exclude from the default action of "embed all Copy Local references", delimited with line breaks + + + + + A list of runtime assembly names to include from the default action of "embed all Copy Local references", delimited with line breaks. + + + + + A list of unmanaged 32 bit assembly names to include, delimited with line breaks. + + + + + A list of unmanaged 64 bit assembly names to include, delimited with line breaks. + + + + + The order of preloaded assemblies, delimited with line breaks. + + + + + + This will copy embedded files to disk before loading them into memory. This is helpful for some scenarios that expected an assembly to be loaded from a physical file. + + + + + Controls if .pdbs for reference assemblies are also embedded. + + + + + Controls if runtime assemblies are also embedded. + + + + + Controls whether the runtime assemblies are embedded with their full path or only with their assembly name. + + + + + Embedded assemblies are compressed by default, and uncompressed when they are loaded. You can turn compression off with this option. + + + + + As part of Costura, embedded assemblies are no longer included as part of the build. This cleanup can be turned off. + + + + + Costura by default will load as part of the module initialization. This flag disables that behavior. Make sure you call CosturaUtility.Initialize() somewhere in your code. + + + + + Costura will by default use assemblies with a name like 'resources.dll' as a satellite resource and prepend the output path. This flag disables that behavior. + + + + + A list of assembly names to exclude from the default action of "embed all Copy Local references", delimited with | + + + + + A list of assembly names to include from the default action of "embed all Copy Local references", delimited with |. + + + + + A list of runtime assembly names to exclude from the default action of "embed all Copy Local references", delimited with | + + + + + A list of runtime assembly names to include from the default action of "embed all Copy Local references", delimited with |. + + + + + A list of unmanaged 32 bit assembly names to include, delimited with |. + + + + + A list of unmanaged 64 bit assembly names to include, delimited with |. + + + + + The order of preloaded assemblies, delimited with |. + + + + + + + + 'true' to run assembly verification (PEVerify) on the target assembly after all weavers have been executed. + + + + + A comma-separated list of error codes that can be safely ignored in assembly verification. + + + + + 'false' to turn off automatic generation of the XML Schema file. + + + + + \ No newline at end of file diff --git a/minecraft-launcher-client/Launcher.cs b/minecraft-launcher-client/Launcher.cs index 50a81e4..af3d80e 100644 --- a/minecraft-launcher-client/Launcher.cs +++ b/minecraft-launcher-client/Launcher.cs @@ -133,7 +133,7 @@ internal static partial class Launcher Directory.GetCurrent()); Logger.LogDebug("LaunchGame", gameOptions); var gameProcess = Process.Start(Config.JavaPath.Str, gameOptions); - gameProcess.WaitForExit(); + gameProcess?.WaitForExit(); Logger.LogInfo("Main", "minecraft closed"); } break; @@ -243,7 +243,8 @@ internal static partial class Launcher public static string NameUUIDFromBytes(byte[] input) { - byte[] hash = MD5.HashData(input); + var md5 = MD5.Create(); + byte[] hash = md5.ComputeHash(input); hash[6] &= 0x0f; hash[6] |= 0x30; hash[8] &= 0x3f; diff --git a/minecraft-launcher-client/launcher-client.csproj b/minecraft-launcher-client/launcher-client.csproj index 157c210..f800f50 100644 --- a/minecraft-launcher-client/launcher-client.csproj +++ b/minecraft-launcher-client/launcher-client.csproj @@ -1,19 +1,29 @@  + - net8.0 + net48 + 12 disable enable Exe launcher_client minecraft-launcher launcher.ico + embedded + true + False + + - + + all + + diff --git a/minecraft-launcher-client/publish.bat b/minecraft-launcher-client/publish.bat index 023c58b..90b87f1 100644 --- a/minecraft-launcher-client/publish.bat +++ b/minecraft-launcher-client/publish.bat @@ -1,10 +1,2 @@ -dotnet publish -c Release -o bin\publish ^ - --self-contained ^ - -r win-x64 ^ - -p:PublishSingleFile=true ^ - -p:PublishTrimmed=true ^ - -p:TrimMode=partial ^ - -p:EnableCompressionInSingleFile=true ^ - -p:OptimizationPreference=Size ^ - -p:InvariantGlobalization=true ^ - -p:DebugType=none +dotnet publish -c Release -o bin\publish +del /f bin\publish\minecraft-launcher.exe.config