btcpayserver/BTCPayServer.Abstractions/Models/BaseBTCPayServerPlugin.cs
Andrew Camilleri 31738c465d
Plugins: Load plugins by order, aesthetic plugin dependency system (#2020)
* Plugins: Load plugins by order, aesthetic plugin dependency system

Introduces plugins loading in order of installation, BTCPay itself shows up as a system plugin, and that plugins can define other plugins as dependencies.

* use a proper type for plugin dependencies

* rebase fixes

* message when cannot install
2020-11-05 15:43:14 +01:00

37 lines
1.1 KiB
C#

using System;
using System.Reflection;
using BTCPayServer.Contracts;
using Microsoft.AspNetCore.Builder;
using Microsoft.Extensions.DependencyInjection;
namespace BTCPayServer.Models
{
public abstract class BaseBTCPayServerPlugin : IBTCPayServerPlugin
{
public abstract string Identifier { get; }
public abstract string Name { get; }
public virtual Version Version
{
get
{
return Assembly.GetAssembly(GetType())?.GetName().Version ?? new Version(1, 0, 0, 0);
}
}
public abstract string Description { get; }
public bool SystemPlugin { get; set; }
public bool SystemExtension { get; set; }
public virtual IBTCPayServerPlugin.PluginDependency[] Dependencies { get; } = Array.Empty<IBTCPayServerPlugin.PluginDependency>();
public virtual void Execute(IApplicationBuilder applicationBuilder,
IServiceProvider applicationBuilderApplicationServices)
{
}
public virtual void Execute(IServiceCollection applicationBuilder)
{
}
}
}