feat(core): add PluginLoader with collectible ALC
This commit is contained in:
parent
9dfbc05052
commit
a7f0732026
8 changed files with 226 additions and 0 deletions
|
|
@ -0,0 +1,19 @@
|
|||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net10.0</TargetFramework>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
<LangVersion>latest</LangVersion>
|
||||
<IsPackable>false</IsPackable>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<!-- Private=false + ExcludeAssets=runtime is CRITICAL: prevents the fixture
|
||||
from copying AcDream.Plugin.Abstractions.dll next to itself, which
|
||||
would cause type-identity mismatch when the ALC loads the fixture
|
||||
and the host already has the abstractions loaded. -->
|
||||
<ProjectReference Include="..\..\src\AcDream.Plugin.Abstractions\AcDream.Plugin.Abstractions.csproj">
|
||||
<Private>false</Private>
|
||||
<ExcludeAssets>runtime</ExcludeAssets>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
20
tests/AcDream.Core.Tests.Fixtures.HelloPlugin/HelloPlugin.cs
Normal file
20
tests/AcDream.Core.Tests.Fixtures.HelloPlugin/HelloPlugin.cs
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
using AcDream.Plugin.Abstractions;
|
||||
|
||||
namespace AcDream.Core.Tests.Fixtures.HelloPlugin;
|
||||
|
||||
public sealed class HelloPlugin : IAcDreamPlugin
|
||||
{
|
||||
public int InitializeCount { get; private set; }
|
||||
public int EnableCount { get; private set; }
|
||||
public int DisableCount { get; private set; }
|
||||
public IPluginHost? ReceivedHost { get; private set; }
|
||||
|
||||
public void Initialize(IPluginHost host)
|
||||
{
|
||||
ReceivedHost = host;
|
||||
InitializeCount++;
|
||||
}
|
||||
|
||||
public void Enable() => EnableCount++;
|
||||
public void Disable() => DisableCount++;
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue