There have been multiple accounts created with the sole purpose of posting advertisement posts or replies containing unsolicited advertising.

Accounts which solely post advertisements, or persistently post them may be terminated.

RonSijm ,
@RonSijm@programming.dev avatar

You’d probably use a different approach for that. Like you’d make your program dynamically load all the .dlls in a “plugins” folder -

Then you’d provide some plugin interface for the users to create plugins, for example:


<span style="color:#323232;">public interface IImageEditorPlugin
</span><span style="color:#323232;">{
</span><span style="color:#323232;">    public void BeforeImageEdit(int[,] imageData);
</span><span style="color:#323232;">    public void AfterImageEdit(int[,] imageData);
</span><span style="color:#323232;">}
</span>

And then you can load plugin classes from all the dlls with dependency injection, and execute them though something like this:


<span style="color:#323232;">public class ImageEditor(IEnumerable<IImageEditorPlugin> plugins)
</span><span style="color:#323232;">{
</span><span style="color:#323232;">    public void EditImage(int[,] imageData)
</span><span style="color:#323232;">    {
</span><span style="color:#323232;">        foreach (var imageEditorPlugin in plugins)
</span><span style="color:#323232;">        {
</span><span style="color:#323232;">            imageEditorPlugin.BeforeImageEdit(imageData);
</span><span style="color:#323232;">            // Do internal image edit function
</span><span style="color:#323232;">            imageEditorPlugin.AfterImageEdit(imageData);
</span><span style="color:#323232;">        }
</span><span style="color:#323232;">    }
</span><span style="color:#323232;">}
</span>

This is a very simple example obviously, normally you’d send more meta-data to the plugins, or have multiple different interfaces depending on the kinda plugin it is, or have some methods to ask plugins when they’re suitable to be used. But this way a user can provide compiled versions of their plugins (in the same language as the core application) - instead of having to provide something like lua scripts

  • All
  • Subscribed
  • Moderated
  • Favorites
  • [email protected]
  • random
  • lifeLocal
  • goranko
  • All magazines