Merge pull request #487 from misternebula/init-assemblies-hotfix

InitializeAssemblies hotfix
This commit is contained in:
Will Corby 2022-02-26 01:01:48 -08:00 committed by GitHub
commit ec6528bbde
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 4 deletions

View File

@ -124,14 +124,20 @@ namespace QSB
foreach (var path in Directory.EnumerateFiles(Helper.Manifest.ModFolderPath, "*.dll")) foreach (var path in Directory.EnumerateFiles(Helper.Manifest.ModFolderPath, "*.dll"))
{ {
var assembly = Assembly.LoadFile(path); var assembly = Assembly.LoadFile(path);
if (Path.GetFileNameWithoutExtension(path) == "ProxyScripts")
{
continue;
}
DebugLog.DebugWrite(assembly.ToString()); DebugLog.DebugWrite(assembly.ToString());
assembly.GetTypes() assembly
.GetTypes()
.SelectMany(x => x.GetMethods(BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Static | BindingFlags.DeclaredOnly)) .SelectMany(x => x.GetMethods(BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Static | BindingFlags.DeclaredOnly))
.Where(x => x.IsDefined(typeof(RuntimeInitializeOnLoadMethodAttribute))) .Where(x => x.IsDefined(typeof(RuntimeInitializeOnLoadMethodAttribute)))
.ForEach(x => x.Invoke(null, null)); .ForEach(x => x.Invoke(null, null));
} }
DebugLog.DebugWrite($"Assemblies initialized", MessageType.Success); DebugLog.DebugWrite("Assemblies initialized", MessageType.Success);
} }
public override void Configure(IModConfig config) => DefaultServerIP = config.GetSettingsValue<string>("defaultServerIP"); public override void Configure(IModConfig config) => DefaultServerIP = config.GetSettingsValue<string>("defaultServerIP");
@ -178,4 +184,4 @@ namespace QSB
* Daft Punk * Daft Punk
* Natalie Holt * Natalie Holt
* WMD * WMD
*/ */

View File

@ -7,7 +7,7 @@
"body": "- Disable *all* other mods. (Can heavily affect performance)\n- Make sure you are not running any other network-intensive applications.\n- Make sure you have forwarded/opened the correct ports. (See the GitHub readme.)" "body": "- Disable *all* other mods. (Can heavily affect performance)\n- Make sure you are not running any other network-intensive applications.\n- Make sure you have forwarded/opened the correct ports. (See the GitHub readme.)"
}, },
"uniqueName": "Raicuparta.QuantumSpaceBuddies", "uniqueName": "Raicuparta.QuantumSpaceBuddies",
"version": "0.17.0", "version": "0.17.1",
"owmlVersion": "2.3.2", "owmlVersion": "2.3.2",
"dependencies": [ "_nebula.MenuFramework" ] "dependencies": [ "_nebula.MenuFramework" ]
} }