Fixed plugin deletion
This commit is contained in:
@@ -111,7 +111,7 @@ public class PluginLoader : IPluginLoader
|
||||
|
||||
var files = installedPlugins.Where(plugin => plugin.IsEnabled).Select(plugin => plugin.FilePath);
|
||||
|
||||
PluginLoaderContext = new PluginLoaderContext("PluginLoader");
|
||||
PluginLoaderContext = new PluginLoaderContext(_Logger, "PluginLoader");
|
||||
|
||||
foreach (var file in files)
|
||||
{
|
||||
|
||||
@@ -1,15 +1,21 @@
|
||||
using System.Reflection;
|
||||
using System.Runtime.Loader;
|
||||
using DiscordBotCore.Logging;
|
||||
|
||||
namespace DiscordBotCore.PluginManagement.Loading;
|
||||
|
||||
public class PluginLoaderContext : AssemblyLoadContext
|
||||
{
|
||||
public PluginLoaderContext(string name) : base(name: name, isCollectible: true) {}
|
||||
private readonly ILogger _logger;
|
||||
|
||||
public PluginLoaderContext(ILogger logger, string name) : base(name: name, isCollectible: true)
|
||||
{
|
||||
_logger = logger;
|
||||
}
|
||||
|
||||
protected override Assembly? Load(AssemblyName assemblyName)
|
||||
{
|
||||
|
||||
_logger.Log("Assembly load requested: " + assemblyName.Name, this);
|
||||
return base.Load(assemblyName);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user