add a simple plugin system
This commit is contained in:
29
Pilz.Plugins.Advanced/PluginModuleController.cs
Normal file
29
Pilz.Plugins.Advanced/PluginModuleController.cs
Normal file
@@ -0,0 +1,29 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Z.Collections.Extensions;
|
||||
|
||||
namespace Pilz.Plugins.Advanced
|
||||
{
|
||||
public sealed class PluginModuleController
|
||||
{
|
||||
public static PluginModuleController Instance { get; private set; } = new();
|
||||
|
||||
private readonly List<PluginModule> modules = new();
|
||||
|
||||
public IReadOnlyList<PluginModule> Modules => modules.AsReadOnly();
|
||||
|
||||
public void RegisterModule(PluginModule module)
|
||||
{
|
||||
if (!modules.Contains(module))
|
||||
modules.Add(module);
|
||||
}
|
||||
|
||||
public void UnregisterModule(PluginModule module)
|
||||
{
|
||||
modules.Remove(module);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user