-
-
Notifications
You must be signed in to change notification settings - Fork 70
Getting Started
BarRaider edited this page Feb 16, 2022
·
6 revisions
- StreamDeck-Tools Template for Visual Studio (2019/2022) - Automatically creates a project with all the files needed to compile a plugin. This is the best way to start a new plugin!
- Install.bat - Script that quickly uninstalls and reinstalls your plugin on the streamdeck (edit the batch file for more details). Put the install.bat file in your BIN folder (same folder that has Debug/Release sub-folders)
- EasyPI - Additional library used to easily pass information from the PI (Property Inspector) to your plugin.
- Profiles Downloadable empty profiles for the XL (32-key), Classic (15-key), Mini (6-key) and Mobile devices at https://barraider.com/profiles
The easiest way to get started is using the Visual Studio Template mentioned above, and taking a look at the samples which demo all the basics to get a plugin working. However, if you don't use the template mentioned above, there are 2 main steps needed to get a plugin up and running:
- In your C# Console Application, Create a class that inherits the
PluginBase
abstract class.
Implement your logic, focusing on the methods provided in the base class.
Follow the samples here for more details
[PluginActionId("plugin.uuid.from.manifest.file")]
public class MyPlugin : PluginBase
{
// Create this constructor in your plugin and pass the objects to the PluginBase class
public MyPlugin(ISDConnection connection, InitialPayload payload) : base(connection, payload)
{
....
// TODO: Use the payload.Settings to see the various settings set in the Property Inspector (in my samples, I create a private class that holds the settings)
// Other relevant settings in the payload include the actual position of the plugin on the Stream Deck
// Note: By passing the `connection` object back to the PluginBase (using the `base` in the constructor), you now have access to a property called `Connection`
// throughout your plugin.
}
....
// TODO: Implement all the remaining abstract functions from PluginBase (or just leave them empty if you don't need them)
// Here is an example of how easy it is to populate settings from the Property Inspector
public override void ReceivedSettings(ReceivedSettingsPayload payload)
{
Tools.AutoPopulateSettings(settings, payload.Settings); // "settings" is a private class that holds the settings for your plugin's instance.
}
}
Note: Use the PluginActionId
attribute to indicate the action UUID associated with this class (must match the UUID set in the manifest file)
- In your program.cs, just pass the args you received to the SDWrapper.Run() function, and you're done!
Example:
class Program
{
static void Main(string[] args)
{
SDWrapper.Run(args);
}
}
- There is no step 3 - that's it! The abstract functions from PluginBase that are implemented in MyPlugin hold all the basics needed for a plugin to work. You can always listen to additional events using the
Connection
property (see the "Subscribing to events" section below).
Next Topic: Samples
© Copyright 2021 By BarRaider