summaryrefslogtreecommitdiff
path: root/Impostor-dev/src/Impostor.Api/Plugins
diff options
context:
space:
mode:
authorchai <chaifix@163.com>2020-12-30 20:59:04 +0800
committerchai <chaifix@163.com>2020-12-30 20:59:04 +0800
commite9ea621b93fbb58d9edfca8375918791637bbd52 (patch)
tree19ce3b1c1f2d51eda6878c9d0f2c9edc27f13650 /Impostor-dev/src/Impostor.Api/Plugins
+init
Diffstat (limited to 'Impostor-dev/src/Impostor.Api/Plugins')
-rw-r--r--Impostor-dev/src/Impostor.Api/Plugins/IPlugin.cs14
-rw-r--r--Impostor-dev/src/Impostor.Api/Plugins/IPluginStartup.cs12
-rw-r--r--Impostor-dev/src/Impostor.Api/Plugins/ImpostorPluginAttribute.cs24
-rw-r--r--Impostor-dev/src/Impostor.Api/Plugins/PluginBase.cs22
4 files changed, 72 insertions, 0 deletions
diff --git a/Impostor-dev/src/Impostor.Api/Plugins/IPlugin.cs b/Impostor-dev/src/Impostor.Api/Plugins/IPlugin.cs
new file mode 100644
index 0000000..fd0f38f
--- /dev/null
+++ b/Impostor-dev/src/Impostor.Api/Plugins/IPlugin.cs
@@ -0,0 +1,14 @@
+using System.Threading.Tasks;
+using Impostor.Api.Events;
+
+namespace Impostor.Api.Plugins
+{
+ public interface IPlugin : IEventListener
+ {
+ ValueTask EnableAsync();
+
+ ValueTask DisableAsync();
+
+ ValueTask ReloadAsync();
+ }
+} \ No newline at end of file
diff --git a/Impostor-dev/src/Impostor.Api/Plugins/IPluginStartup.cs b/Impostor-dev/src/Impostor.Api/Plugins/IPluginStartup.cs
new file mode 100644
index 0000000..aa6a35f
--- /dev/null
+++ b/Impostor-dev/src/Impostor.Api/Plugins/IPluginStartup.cs
@@ -0,0 +1,12 @@
+using Microsoft.Extensions.DependencyInjection;
+using Microsoft.Extensions.Hosting;
+
+namespace Impostor.Api.Plugins
+{
+ public interface IPluginStartup
+ {
+ void ConfigureHost(IHostBuilder host);
+
+ void ConfigureServices(IServiceCollection services);
+ }
+} \ No newline at end of file
diff --git a/Impostor-dev/src/Impostor.Api/Plugins/ImpostorPluginAttribute.cs b/Impostor-dev/src/Impostor.Api/Plugins/ImpostorPluginAttribute.cs
new file mode 100644
index 0000000..b31bd47
--- /dev/null
+++ b/Impostor-dev/src/Impostor.Api/Plugins/ImpostorPluginAttribute.cs
@@ -0,0 +1,24 @@
+using System;
+
+namespace Impostor.Api.Plugins
+{
+ [AttributeUsage(AttributeTargets.Class)]
+ public class ImpostorPluginAttribute : Attribute
+ {
+ public ImpostorPluginAttribute(string package, string name, string author, string version)
+ {
+ Package = package;
+ Name = name;
+ Author = author;
+ Version = version;
+ }
+
+ public string Package { get; }
+
+ public string Name { get; }
+
+ public string Author { get; }
+
+ public string Version { get; }
+ }
+} \ No newline at end of file
diff --git a/Impostor-dev/src/Impostor.Api/Plugins/PluginBase.cs b/Impostor-dev/src/Impostor.Api/Plugins/PluginBase.cs
new file mode 100644
index 0000000..0384363
--- /dev/null
+++ b/Impostor-dev/src/Impostor.Api/Plugins/PluginBase.cs
@@ -0,0 +1,22 @@
+using System.Threading.Tasks;
+
+namespace Impostor.Api.Plugins
+{
+ public class PluginBase : IPlugin
+ {
+ public virtual ValueTask EnableAsync()
+ {
+ return default;
+ }
+
+ public virtual ValueTask DisableAsync()
+ {
+ return default;
+ }
+
+ public virtual ValueTask ReloadAsync()
+ {
+ return default;
+ }
+ }
+} \ No newline at end of file