
Getting Started
Setting up the Project
-
- Create a new Blank Solution in Visual Studio
- Add a new Project > Choose “Class Library”
- Name your class MyPlugin.Launchbox.Core > Click Next
- Choose .Net Core 3.1 > Click Create
- Right Click on the project and select “unload Project” a file ending
.csproj
should open. Add some Elements to theTargetFramework
element to look like the below and then Reload the project:
1 2 3 4 5 6 |
<PropertyGroup> <TargetFramework>netcoreapp3.1</TargetFramework> <UseWindowsForms>true</UseWindowsForms> <UseWPF>true</UseWPF> <BaseOutputPath>C:\Users\stigz\LaunchBox\Plugins\GearBox</BaseOutputPath> </PropertyGroup> |
Setting up the project for .NET Framework
You can also author your plugin in framework. You will just have to import some library like System.Drawing.Common.
Setting up Build and Debugging in Visual Studio
If Setting up in a .NET (Core) project:
- Open the project Properties
- Select Build>Output and set Base Output Path To a folder inside the launchbox Plugins folder (e.g. “C:\Users\Dave\Launchbox\Plugins\MyPlugin”)
- Select Debug>General>Open debug launch profiles UI
- Add a New Profile and choose the Executable type as per below:
- Rename the selected profile to something like “LB Debug” and in “Path the the executable” navigate to the Launchbox.exe in the Core folder (NB. not the one in the root directory) – e.g. C:\Users\Dave\LaunchBox\Core\LaunchBox.exe
- Delete the existing Debug profile
If Setting up in a .NET Framework project:
- Download and install this extension here (or equivalent for your VS version): Microsoft Child Process Debugging Power Tool 2022
- Select Build>Output and set Base Output Path To a folder inside the launchbox Plugins folder (e.g. “C:\Users\Dave\Launchbox\Plugins\MyPlugin”)
- Open Project Settings>Debug and set the Start Action to Start External Program and set to “C:\Users\[youruseraccount]\LaunchBox\LaunchBox.exe” (NB: not the one in the Core folder)
- Also set “Enable native code debugging” to True
- In the Main Menu Click Debug>Other Debug Targets>Child Process Debugging Settings
- Set up a new entry as below:
Creating a menu command in the Launchbox Tools menu
- Create a folder called “PluginHooks”
- Create a new class in this called
SystemMenuItem
and copy the following code into it:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
using MyPlugin.Core.Properties; using System.Diagnostics; using Unbroken.LaunchBox.Plugins; namespace MyPlugin.Core.PluginInterfaces { public class SystemMenuItem : ISystemMenuItemPlugin { public string Caption => "My First Plugin"; public System.Drawing.Image IconImage => null; public bool ShowInLaunchBox => true; public bool ShowInBigBox => false; public bool AllowInBigBoxWhenLocked => false; public void OnSelected() { Debug.WriteLine("YAY!"); } } } |
Leave a Reply