Skip to content

Commit

Permalink
v2.2
Browse files Browse the repository at this point in the history
1. Added support to switching plugin profiles.
2. The DeviceId that the plugin is on is now accessible
  • Loading branch information
BarRaider committed May 24, 2019
1 parent 480fb13 commit 08a5ffc
Show file tree
Hide file tree
Showing 4 changed files with 46 additions and 18 deletions.
10 changes: 8 additions & 2 deletions StreamDeck-Tools.sln
@@ -1,10 +1,12 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 15
VisualStudioVersion = 15.0.28307.106
# Visual Studio Version 16
VisualStudioVersion = 16.0.28917.181
MinimumVisualStudioVersion = 10.0.40219.1
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "barraider-sdtools", "barraider-sdtools\barraider-sdtools.csproj", "{DABBD97D-6687-4CBD-A19E-AC9FFA3CEF03}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "streamdeck-client-csharp", "..\streamdeck-client-csharp\streamdeck-client-csharp\streamdeck-client-csharp.csproj", "{8D3FE999-1DCC-42A3-9B8F-E3B0838F6DF7}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand All @@ -15,6 +17,10 @@ Global
{DABBD97D-6687-4CBD-A19E-AC9FFA3CEF03}.Debug|Any CPU.Build.0 = Debug|Any CPU
{DABBD97D-6687-4CBD-A19E-AC9FFA3CEF03}.Release|Any CPU.ActiveCfg = Release|Any CPU
{DABBD97D-6687-4CBD-A19E-AC9FFA3CEF03}.Release|Any CPU.Build.0 = Release|Any CPU
{8D3FE999-1DCC-42A3-9B8F-E3B0838F6DF7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{8D3FE999-1DCC-42A3-9B8F-E3B0838F6DF7}.Debug|Any CPU.Build.0 = Debug|Any CPU
{8D3FE999-1DCC-42A3-9B8F-E3B0838F6DF7}.Release|Any CPU.ActiveCfg = Release|Any CPU
{8D3FE999-1DCC-42A3-9B8F-E3B0838F6DF7}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand Down
5 changes: 2 additions & 3 deletions barraider-sdtools/PluginContainer.cs
@@ -1,5 +1,4 @@
using BarRaider.SdTools;
using Newtonsoft.Json.Linq;
using Newtonsoft.Json.Linq;
using streamdeck_client_csharp;
using streamdeck_client_csharp.Events;
using System;
Expand Down Expand Up @@ -126,7 +125,7 @@ private async void RunTick()
// Stopwatch instance created
private async void Connection_OnWillAppear(object sender, StreamDeckEventReceivedEventArgs<WillAppearEvent> e)
{
SDConnection conn = new SDConnection(connection, pluginUUID, e.Event.Action, e.Event.Context);
SDConnection conn = new SDConnection(connection, pluginUUID, e.Event.Action, e.Event.Context, e.Event.Device);
await instancesLock.WaitAsync();
try
{
Expand Down
31 changes: 30 additions & 1 deletion barraider-sdtools/SDConnection.cs
Expand Up @@ -101,6 +101,27 @@ public async Task SetTitleAsync(string title)
await StreamDeckConnection.SetTitleAsync(title, ContextId, streamdeck_client_csharp.SDKTarget.HardwareAndSoftware);
}

/// <summary>
/// Switches to one of the plugin's built-in profiles
/// </summary>
/// <param name="profileName"></param>
/// <returns></returns>
public async Task SwitchProfileAsync(string profileName)
{
await StreamDeckConnection.SwitchToProfileAsync(this.DeviceId, profileName, this.pluginUUID);
}

/// <summary>
/// Switches to one of the plugin's built-in profiles. Allows to choose which device to switch it on.
/// </summary>
/// <param name="profileName"></param>
/// <param name="deviceId"></param>
/// <returns></returns>
public async Task SwitchProfileAsync(string profileName, string deviceId)
{
await StreamDeckConnection.SwitchToProfileAsync(deviceId, profileName, this.pluginUUID);
}

/// <summary>
/// Shows the Alert (Yellow Triangle) on the StreamDeck key
/// </summary>
Expand Down Expand Up @@ -146,6 +167,12 @@ public async Task LogSDMessage(string message)
[JsonIgnore]
public String ContextId { get; private set; }

/// <summary>
/// An opaque value identifying the device the plugin is launched on.
/// </summary>
[JsonIgnore]
public String DeviceId { get; private set; }

/// <summary>
/// StreamDeckConnection object, initialized based on the args received when launching the program
/// </summary>
Expand All @@ -160,12 +187,14 @@ public async Task LogSDMessage(string message)
/// <param name="pluginUUID"></param>
/// <param name="actionId"></param>
/// <param name="contextId"></param>
public SDConnection(streamdeck_client_csharp.StreamDeckConnection connection, string pluginUUID, string actionId, string contextId)
/// /// <param name="deviceId"></param>
public SDConnection(streamdeck_client_csharp.StreamDeckConnection connection, string pluginUUID, string actionId, string contextId, string deviceId)
{
StreamDeckConnection = connection;
this.actionId = actionId;
this.ContextId = contextId;
this.pluginUUID = pluginUUID;
this.DeviceId = deviceId;
}
}
}
18 changes: 6 additions & 12 deletions barraider-sdtools/barraider-sdtools.csproj
Expand Up @@ -3,7 +3,7 @@
<TargetFrameworks>netstandard2.0;net472</TargetFrameworks>
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
<Authors>BarRaider</Authors>
<Product>StreamDeck Tools by BarRaider</Product>
<Product>Stream Deck Tools by BarRaider</Product>
<Description>Start developing your Elgato StreamDeck plugin faster!
This library encapsulates all the overhead of setting up the framework, so that you can focus on writing the logic of the plugin itself.
[Samples for using the library are provided here: https://github.com/BarRaider/streamdeck-tools]
Expand All @@ -16,16 +16,10 @@ Feel free to contact me for more information: https://barraider.github.io</Descr
<PackageTags>StreamDeck Elgato Library Plugin Stream Deck</PackageTags>
<PackageId>StreamDeck-Tools</PackageId>
<PackageIconUrl>https://raw.githubusercontent.com/BarRaider/barraider.github.io/master/images/BRLogo.png</PackageIconUrl>
<AssemblyVersion>2.0.1.0</AssemblyVersion>
<FileVersion>2.0.1.0</FileVersion>
<Version>2.0.1</Version>
<PackageReleaseNotes>2.0.1 - Fixed bug which caused issues when adding plugins to MultiActions

Note: Library has been optimized for the new 4.1 SDK!

Some of the changes are breaking existing interfaces. Upgrade instruction are available on the Github page:
https://github.com/BarRaider/streamdeck-tools
Added new functionality + more data to existing methods. Plugin creation is now much easier</PackageReleaseNotes>
<AssemblyVersion>2.2.0.0</AssemblyVersion>
<FileVersion>2.2.0.0</FileVersion>
<Version>2.2</Version>
<PackageReleaseNotes>2.2 - Added support to switching plugin profiles. 2. The DeviceId that the plugin is on is now accessible</PackageReleaseNotes>
<RootNamespace>BarRaider.SdTools</RootNamespace>
<AssemblyName>StreamDeckTools</AssemblyName>
</PropertyGroup>
Expand All @@ -36,7 +30,7 @@ Added new functionality + more data to existing methods. Plugin creation is now
<PackageReference Include="CommandLineParser" Version="2.4.3" />
<PackageReference Include="Newtonsoft.Json" Version="12.0.1" />
<PackageReference Include="NLog" Version="4.5.11" />
<PackageReference Include="streamdeck-client-csharp" Version="4.1.0" />
<PackageReference Include="streamdeck-client-csharp" Version="4.1.1" />
<PackageReference Include="System.Drawing.Common" Version="4.5.1" />
</ItemGroup>
<ItemGroup>
Expand Down

0 comments on commit 08a5ffc

Please sign in to comment.