mirror of
https://github.com/BepInEx/BepInEx.git
synced 2026-10-19 15:51:45 +00:00
Use Assembly.LoadFrom for loading assemblies
Assembly.LoadFile is meant for a special case that is not relevant to BepInEx
This commit is contained in:
1 parent
c0b9eae558
commit
b9fe507672
3 files changed
+4
-4
No files matched your search
@@ -125,7 +125,7 @@ public abstract class BaseChainloader<TPlugin>
|
||||
/// Contains information about what certain plugins were not loaded.
|
||||
/// </summary>
|
||||
public List<string> DependencyErrors { get; } = new();
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Occurs after a plugin is loaded.
|
||||
/// </summary>
|
||||
@@ -404,7 +404,7 @@ public abstract class BaseChainloader<TPlugin>
|
||||
Logger.Log(LogLevel.Info, $"Loading [{plugin}]");
|
||||
|
||||
if (!loadedAssemblies.TryGetValue(plugin.Location, out var ass))
|
||||
loadedAssemblies[plugin.Location] = ass = Assembly.LoadFile(plugin.Location);
|
||||
loadedAssemblies[plugin.Location] = ass = Assembly.LoadFrom(plugin.Location);
|
||||
|
||||
Plugins[plugin.Metadata.GUID] = plugin;
|
||||
TryRunModuleCtor(plugin, ass);
|
||||
|
||||
@@ -242,7 +242,7 @@ public static class Utility
|
||||
/// <param name="assembly">The loaded assembly.</param>
|
||||
/// <returns>True, if the assembly was found and loaded. Otherwise, false.</returns>
|
||||
public static bool TryResolveDllAssembly(AssemblyName assemblyName, string directory, out Assembly assembly) =>
|
||||
TryResolveDllAssembly(assemblyName, directory, Assembly.LoadFile, out assembly);
|
||||
TryResolveDllAssembly(assemblyName, directory, Assembly.LoadFrom, out assembly);
|
||||
|
||||
/// <summary>
|
||||
/// Try to resolve and load the given assembly DLL.
|
||||
|
||||
@@ -139,6 +139,6 @@ namespace BepInEx.NET.Shared
|
||||
/// <param name="assembly">The loaded assembly.</param>
|
||||
/// <returns>True, if the assembly was found and loaded. Otherwise, false.</returns>
|
||||
public static bool TryResolveDllAssembly(AssemblyName assemblyName, string directory, out Assembly assembly) =>
|
||||
TryResolveDllAssembly(assemblyName, directory, Assembly.LoadFile, out assembly);
|
||||
TryResolveDllAssembly(assemblyName, directory, Assembly.LoadFrom, out assembly);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user