masfenix
masfenix

Reputation: 7986

how to create very basic plugin system

so lets layout the design first. I have a combobox with a button, and i have a plugins folder.

lets say i have a plugin imageeffect.cs in the plugins folder. this class MUST have properties such as "title". My program gets this "title" and dynamically load the combobox with this title. So now my program recognizes the plugin. Now when the user clicks the button, I want some data (processed by my program) be passed off to the imageeffect.cs plugin where it does whatever work on it and returns me a status.

so recap. my program reads a plugin directory. loads up each plugin's "title" property (defined my whoever is creating the plugin) to the combobox. When the user clicks the button, the "data" or in this case the image is sent to the plugin and the plugin does work on it. it then returns me the "Status" or in this case a picture back with whatever effects it wanted.

Upvotes: 5

Views: 3949

Answers (3)

BFree
BFree

Reputation: 103742

I wrote a blog post a while back to illustrate a very simple plugin system. This may be good enough for your needs:

http://crazorsharp.blogspot.com/2009/03/net-reflection-part-2-loading.html

Upvotes: 4

FallenAvatar
FallenAvatar

Reputation: 4079

Ok. FIrst I would suggest that your plugins are compiled .dlls rather than just .cs files. However, if you would like to use just .cs files, first take a look here:

http://www.codeproject.com/KB/cs/livecodedotnet.aspx

And then for implementing the plugin system, look at this article:

http://www.codeproject.com/KB/cs/c__plugin_architecture.aspx

Hope that helps :)

Upvotes: 0

dtb
dtb

Reputation: 217233

MEF with a DirectoryCatalog.

Upvotes: 9

Related Questions