Extending LaunchBox with plugin support

Issue #569 resolved
Costin Popescu created an issue

It would be really useful if LaunchBox could be extendable through an API. Imagine if people could create their own plugins that would add some currently missing features - we could have a community producing new extensions, like the one for WordPress.

Basically, the request is to add an API to LaunchBox, a way to have your plugin options somewhere in the menu, and eventually some space in the main interface for showing widgets.

I've marked this as "major" not because it should necessarily be a big priority, but because it would be a game changer (pun intended) for the product.

Comments (6)

  1. John Klein

    I wanted to request the same thing so I've come here to make a few notes that could accelerate this as an option if it was undertaken. I've been using small simple data scrapers I threw together to inject data into LaunchBox's XML database. A proper plugin system would allow me to make my work a publishable tool rather than a personal one-shot.

    The first two types of plugins I'd suggest adding if you did this would be Game Import plugins (there are several of these built into LaunchBox) and Game Processing plugins ('Download Meta Data and Images' would be the first item of this type that's built into LaunchBox).

    .net allows for easy access to the contents of other .net dlls. Here's an example of some code from one of my own C# programs:

    if (!Directory.Exists(pluginsDir)) Directory.CreateDirectory(pluginsDir);
    List<string> plugins = Directory.GetFiles(pluginsDir, "*.dll", SearchOption.TopDirectoryOnly).ToList();
    plugins.ForEach(dr =>
    {
        try
        {
            ICharacterLoader[] pluginInstances = LoadAssembly(dr);
            foreach (ICharacterLoader plugin in pluginInstances)
            {
                CharacterLoaders.Add(plugin);
            }
        }
        catch { }
    });
    

    All you would need to do is provide a public interface to implement and a few function interfaces. The best method I've found is to define your plugin interface with an Initialize function that passes an object instance as a parameter containing the interface for what program logic you wish to give the plugin access to.

  2. Log in to comment