From 027ffd2d9f2a89df0bbd545fb45d2e1db6aab8cf Mon Sep 17 00:00:00 2001 From: Aragas Date: Thu, 27 Oct 2022 14:13:39 +0300 Subject: [PATCH] Fixed assembly loading resolver --- .../AssemblyResolver/Patches/AssemblyLoaderPatch.cs | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) diff --git a/src/Bannerlord.BUTRLoader/Features/AssemblyResolver/Patches/AssemblyLoaderPatch.cs b/src/Bannerlord.BUTRLoader/Features/AssemblyResolver/Patches/AssemblyLoaderPatch.cs index 6b86c1a..03de17b 100644 --- a/src/Bannerlord.BUTRLoader/Features/AssemblyResolver/Patches/AssemblyLoaderPatch.cs +++ b/src/Bannerlord.BUTRLoader/Features/AssemblyResolver/Patches/AssemblyLoaderPatch.cs @@ -9,11 +9,8 @@ using System.Reflection; using System.Runtime.CompilerServices; -using TaleWorlds.Engine; using TaleWorlds.Library; -using Path = System.IO.Path; - namespace Bannerlord.BUTRLoader.Features.AssemblyResolver.Patches { internal static class AssemblyLoaderPatch @@ -33,16 +30,10 @@ private static bool OnAssemblyResolvePrefix(ref Assembly? __result, ResolveEvent { try { - var basePath = Utilities.GetBasePath(); - var configName = Common.ConfigName; - var modulePath = Path.GetFullPath(Path.Combine(basePath, "Modules")); - var name = args.Name.Contains(',') ? $"{args.Name.Split(',')[0]}.dll" : args.Name; - var assemblies = ModuleInfoHelper.GetLoadedModules() - .Select(x => Path.Combine(modulePath, x.Id, "bin", configName)) - .Where(Directory.Exists) - .Select(x => Directory.GetFiles(x, "*.dll")).ToArray(); + var assemblies = ModuleInfoHelper.GetLoadedModules().OfType() + .Select(x => Directory.GetFiles(x.Path, "*.dll")).ToArray(); var assembly = assemblies .SelectMany(x => x)