Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/nabeghe/pluginer
Run dll files as a plugin, create plugin for your software
https://github.com/nabeghe/pluginer
compile compiler csharp dll extension plugin pluginer plugins
Last synced: about 23 hours ago
JSON representation
Run dll files as a plugin, create plugin for your software
- Host: GitHub
- URL: https://github.com/nabeghe/pluginer
- Owner: nabeghe
- License: mit
- Created: 2022-01-19T19:11:35.000Z (almost 3 years ago)
- Default Branch: master
- Last Pushed: 2023-10-14T14:23:34.000Z (about 1 year ago)
- Last Synced: 2024-10-07T17:37:01.018Z (about 1 month ago)
- Topics: compile, compiler, csharp, dll, extension, plugin, pluginer, plugins
- Language: C#
- Homepage:
- Size: 11.7 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Pluginer
> Run dll files as a plugin
>
> Do you need everyone can create plugin for your softwares?
>
> Now, you can simply use the Pluginer for this purpose# Install Nuget
`Install-Package Pluginer -Version 2.0.1`# How to Work
* Pluginer used to run dll files inside a path.
* Each plugin file (dll) can be placed directly in the plugins path or it can be placed in a seperate folder in the plugins path with the same name as the plugin
* The default plugins path is `Plugins` folder in the application root path
* By default, the Pluginer will instance only classes that inherit from `Pluginer.PluginObject`. you can change it by assigning parents parameter in the `PluginRunner` constructor. in addition when parents are empty, Pluginer create object for each classes.# Example
```csharp
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Reflection;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using Pluginer;namespace PluginerDemo
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();var pr = new PluginRunner();
pr.OnLoadClass += Pr_OnLoadClass;
pr.OnLoadPlugin += Pr_OnLoadPlugin;
pr.OnError += Pr_OnError;
var args = new PluginArgs();
args["form"] = this;
pr.Load(args);
}private void Pr_OnLoadPlugin(PluginRunner runner, PluginEventArgs e)
{
rtb.AppendText($"> The plugin `{e.Plugin.Name}` Loaded.\n");
}private void Pr_OnLoadClass(PluginRunner runner, PluginEventArgs e)
{
rtb.AppendText($"> The class : `{e.Type}` Loaded from plugin `{e.Plugin.Name}`\n");
}private void Pr_OnError(PluginRunner runner, PluginEventArgs e)
{
rtb.AppendText($"> Error Plugin `{e.Plugin.Name}`: `{e.Error.Message}`\n");
}}
}```
# Sample Plugin
```csharp
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;namespace ClassLibrary1
{
public class Class1 : Pluginer.PluginObject
{public Class1(Pluginer.PluginArgs args)
{
MessageBox.Show("Hi");
dynamic form = args["form"];
form.menuStrip1.Items.Add("Menu 1");
form.menuStrip1.Items.Add("Menu 2");
form.menuStrip1.Items.Add("Menu 3");
form.menuStrip1.Items.Add("Menu 4");
form.menuStrip1.Items.Add("Menu 5");
//Notice: don't forgot to change menuStrip1 control Modifiers to public
}}
}```