23 lines
898 B
C#
23 lines
898 B
C#
using System.Runtime.Loader;
|
|
using AcDream.Plugin.Abstractions;
|
|
|
|
namespace AcDream.Core.Plugins;
|
|
|
|
/// <summary>
|
|
/// Outcome of a plugin load attempt.
|
|
/// <para>On success, <see cref="Plugin"/> is the instantiated plugin, <see cref="LoadContext"/>
|
|
/// owns its assembly, and <see cref="Error"/> is null.</para>
|
|
/// <para>On failure, <see cref="Error"/> describes what went wrong. A partial
|
|
/// <see cref="Plugin"/> and/or <see cref="LoadContext"/> may still be present;
|
|
/// the caller owns their cleanup. The loader never requests collectible unload
|
|
/// itself because the session must first roll back host registrations.</para>
|
|
/// </summary>
|
|
public sealed record LoadedPlugin(
|
|
PluginManifest Manifest,
|
|
IAcDreamPlugin? Plugin,
|
|
AssemblyLoadContext? LoadContext,
|
|
Exception? Error)
|
|
{
|
|
public bool Success =>
|
|
Plugin is not null && LoadContext is not null && Error is null;
|
|
}
|