Updated plugin installation

This commit is contained in:
2024-07-06 18:42:45 +03:00
parent 48a133d58c
commit 2052eb634a
6 changed files with 66 additions and 10 deletions

View File

@@ -192,7 +192,7 @@ internal static class PluginMethods
await Parallel.ForEachAsync(downloadTasks, options, async (tuple, token) =>
{
tuple.Item1.IsIndeterminate = false;
string downloadLocation = Application.CurrentApplication.PluginManager.GenerateDependencyLocation(pluginName, tuple.Item4);
string downloadLocation = Application.CurrentApplication.PluginManager.GenerateDependencyRelativePath(pluginName, tuple.Item4);
await ServerCom.DownloadFileAsync(tuple.Item3, downloadLocation, tuple.Item2);
}
);

View File

@@ -6,6 +6,7 @@ using System.Reflection;
namespace DiscordBot;
public static class Entry
{
/// <summary>
@@ -58,7 +59,7 @@ public static class Entry
static Assembly LoadFromSameFolder(object sender, ResolveEventArgs args)
{
string requestingAssembly = args.RequestingAssembly?.GetName().Name;
var folderPath = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location)!, $"Libraries\\{requestingAssembly}");
var folderPath = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location)!, $"Libraries/{requestingAssembly}");
var assemblyPath = Path.Combine(folderPath, new AssemblyName(args.Name).Name + ".dll");
if (!File.Exists(assemblyPath))
return null;