🚧 Core API and abstractions extending

This commit is contained in:
2020-03-02 00:00:44 +04:00
parent ed255e2506
commit e86049f4fd
7 changed files with 198 additions and 0 deletions
+16
View File
@@ -66,6 +66,7 @@ namespace Kruzya.TelegramBot.Core
{
_configuration = configuration;
HookAppDomain();
Start();
}
@@ -156,5 +157,20 @@ namespace Kruzya.TelegramBot.Core
return module;
}
private void HookAppDomain()
{
AppDomain.CurrentDomain.AssemblyResolve += delegate(object? sender, ResolveEventArgs args)
{
var basePath = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
string assemblyPath = Path.Combine(basePath, new AssemblyName(args.Name).Name + ".dll");
if (!File.Exists(assemblyPath))
{
return null;
}
return Assembly.LoadFrom(assemblyPath);
};
}
}
}