UpsettingBoy / CSharpPluginManager

Simple plugin manager for .NET

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

CSharp Plugin Manager

This library reduces the amount of work needed for the implementation of a plugin manager into an application.

Usage (host application)

Firstly, add PluginManager project into yours by cloning and referencing or by Nuget (added later). Then, follow the example below:

using UpsettingBoy.CSharpPluginManager;

public class DesiredClass
{
    public DesiredClass()
    {
        PluginManager manager = new PluginManager("<plugins_location>");
        manager.EnablePlugins();

        //For viewing plugins state use...
        //manager.PluginsState; (is a SortedMap)
    }
}

You also need to provide plugin developers an API for access your application features.

If you are concerned about the lack of UI support for plugin implementation, I am working on it (adding a new method on IPlugin interface).

Usage (plugin developer)

In order to your plugin to be loaded by PluginManager it has to implement IPlugin interface. You can add this interface by cloning and referencing Plugin project into yours or by the Nuget package (added later on), then, simply implements the interface in ONLY ONE CLASS of your plugin (OnEnable method will become the entry point of your plugin). An example class:

using UpsettingBoy.CSharpPlugin;

public class MainClass : IPlugin
{
    public string Name => "YourPluginName";
    public string Author => "YourName";

    public void OnEnable()
    {
        //your plugin stuff.
    }
}

In the future, it might be added new methods/properties into IPlugin so backwards compatibility migth be a problem. Watch out PluginManager version given by the host application of your plugin.

License

This project is under a MIT license.

CSharpPluginManager also uses:

  • Microsoft.CSharp -> MIT license.

Additional information of licenses on Licenses folder.

About

Simple plugin manager for .NET

License:MIT License


Languages

Language:C# 100.0%