mirror of
https://github.com/Bubuni-Team/telegram-bot.git
synced 2026-07-31 00:29:24 +03:00
🚧 Core API and abstractions extending
This commit is contained in:
@@ -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);
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user