Skip to content

Commit

Permalink
Add directory info to plugin host
Browse files Browse the repository at this point in the history
  • Loading branch information
Kaioru committed Sep 18, 2024
1 parent 1bc4c93 commit 28a9a74
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 3 deletions.
5 changes: 3 additions & 2 deletions src/common/Edelstein.Common.Plugin/PluginHost.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,14 @@ namespace Edelstein.Common.Plugin;
public record PluginHost<TContext>(
IPluginHostManifest? Manifest,
IPluginManager<TContext> Manager,
IPlugin<TContext> Plugin
IPlugin<TContext> Plugin,
string DirectoryApp,
string DirectoryPlugin
) : IPluginHost<TContext>
{
private readonly Dictionary<string, List<MethodInfo>> _exports = new();

public string ID => Plugin.ID;

public void Export<T>()
{
foreach (var method in typeof(T)
Expand Down
8 changes: 7 additions & 1 deletion src/common/Edelstein.Common.Plugin/PluginManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,13 @@ private async Task LoadFromFile(string path, IPluginHostManifest? manifest)
}

await Insert(new PluginManagerEntry<TContext>(
new PluginHost<TContext>(manifest, this, plugin),
new PluginHost<TContext>(
manifest,
this,
plugin,
AppDomain.CurrentDomain.BaseDirectory,
path
),
plugin
));
}
Expand Down
4 changes: 4 additions & 0 deletions src/protocol/Edelstein.Protocol.Plugin/IPluginHost.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System;
using System.IO;
using Edelstein.Protocol.Utilities.Repositories;

namespace Edelstein.Protocol.Plugin;
Expand All @@ -8,6 +9,9 @@ public interface IPluginHost<TContext> : IRepositoryEntry<string>
IPluginHostManifest? Manifest { get; }
IPluginManager<TContext> Manager { get; }
IPlugin<TContext> Plugin { get; }

string DirectoryApp { get; }
string DirectoryPlugin { get; }

void Export<T>();
void Import<T>();
Expand Down

0 comments on commit 28a9a74

Please sign in to comment.