Giter Site home page Giter Site logo

sharpdeck's Introduction

SharpDeck verion on NuGet.org Build status

SharpDeck

A comprehensive .NET wrapper for creating Stream Deck plugins, using the official Stream Deck SDK documentation. SharpDeck takes the hassle out of communicating with the Stream Deck SDK, and handles action caching and event delegation.

๐Ÿ“ฆ Examples

  • Counter - Single action counter plugin.
  • Shared Counter - Multiple action plugin with a shared counter and reset.

โœ๏ธ Creating a plugin

SharpDeck enables console applications to easily communicate with Stream Deck; run dotnet new console to create a .NET console application, and follow these five steps to create your first Stream Deck plugin.

๐Ÿ”— 1. Program.cs

public static void Main(string[] args)
{
#if DEBUG
    System.Diagnostics.Debugger.Launch(); 
#endif

    // Connect to Stream Deck.
    SharpDeck.StreamDeckPlugin.Run();
}

โšก 2. Create an action

using SharpDeck;
using SharpDeck.Events.Received; 

[StreamDeckAction("com.geekyeggo.exampleplugin.firstaction")]
public class MyFirstAction : StreamDeckAction
{
    // Methods can be overriden to intercept events received from the Stream Deck.
    protected override Task OnKeyDown(ActionEventArgs<KeyPayload> args) => ...;
    protected override Task OnKeyUp(ActionEventArgs<KeyPayload> args) => ...;
}

๐Ÿ“„ 3. Create a manifest.json file

For more information about creating a manifest file, please refer to the SDK documentation.

โš™๏ธ 4. Configure .csproj

<!-- Install the plugin after each build - change authorName and pluginName accordingly. -->
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
    <OutputPath>$(APPDATA)\Elgato\StreamDeck\Plugins\com.{{authorName}}.{{pluginName}}.sdPlugin\</OutputPath>
    <AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>
</PropertyGroup>

<ItemGroup>
    <!-- The manifest file is required by Stream Deck and provides important information. -->
    <None Update="manifest.json">
        <CopyToOutputDirectory>Always</CopyToOutputDirectory>
    </None>
</ItemGroup>

<!-- Kill the Stream Deck process before each build; this allows the copy to occur. -->
<Target Name="PreBuild" BeforeTargets="PreBuildEvent" Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
    <Exec Command="taskkill -f -t -im StreamDeck.exe -fi &quot;status eq running&quot;" />
</Target>

๐Ÿšง 5. Debug profile

Located at Properties/launchSettings.json; this debug profile will automatically launch StreamDeck.exe when debugging starts.

{
  "profiles": {
    "DebugWin": {
      "commandName": "Executable",
      "executablePath": "c:\\windows\\system32\\cmd.exe",
      "commandLineArgs": "/S /C \"start \"title\" /B \"%ProgramW6432%\\Elgato\\StreamDeck\\StreamDeck exe\" \""
    }
  }
}

๐Ÿƒ Running

When debugging starts (default F5):

  1. The plugin will be built and installed.
  2. Stream Deck will then launch.
  3. You will be prompted to attach your plugin to a process; this allows for debugging.

When your plugin is ready, consider packaging and distributing it on the Stream Deck store.

๐Ÿ“ƒ License

The MIT License (MIT) Stream Deck is a trademark or registered trademark of Elgato Systems.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.