初始提交
This commit is contained in:
@@ -0,0 +1,36 @@
|
||||
using Microsoft.Extensions.Configuration;
|
||||
|
||||
namespace MAF1.Plugins;
|
||||
|
||||
public sealed class PluginOptions
|
||||
{
|
||||
public string Directory { get; set; } = "plugins";
|
||||
public int DefaultTimeoutSeconds { get; set; } = 180;
|
||||
|
||||
public string ResolveRoot()
|
||||
{
|
||||
if (Path.IsPathRooted(Directory))
|
||||
{
|
||||
return Directory;
|
||||
}
|
||||
|
||||
return Path.GetFullPath(Path.Combine(AppContext.BaseDirectory, Directory));
|
||||
}
|
||||
|
||||
public static PluginOptions Load(IConfiguration config)
|
||||
=> config.GetSection("Plugins").Get<PluginOptions>() ?? new PluginOptions();
|
||||
}
|
||||
|
||||
public sealed class LoadedPlugin
|
||||
{
|
||||
public required string FolderName { get; init; }
|
||||
public required string FolderPath { get; init; }
|
||||
public required PluginContract.PluginManifest Manifest { get; init; }
|
||||
}
|
||||
|
||||
public sealed class CatalogIssue
|
||||
{
|
||||
public string Level { get; init; } = "error";
|
||||
public string Source { get; init; } = "";
|
||||
public string Message { get; init; } = "";
|
||||
}
|
||||
Reference in New Issue
Block a user