Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
…olkit into dev

* 'dev' of https://github.com/FritzAndFriends/StreamDeckToolkit:
  Adding today's cheers
  Fixed the reference to the CMD file
  Fixed symbols in the template
  Fixed SamplePlugin namespace
  Fixed broken build
  Merged
  b41: Updates to support SDK v4.1 (FritzAndFriends#141)
  Final Beta 4.1 implementation (FritzAndFriends#140)
  Updated Template Files for 4.1 Beta 2 (FritzAndFriends#115)
  Updated to Beta 2 and other fixes (FritzAndFriends#113)
  Initial Beta 4.1 Code (FritzAndFriends#106)
  • Loading branch information
hugodahl committed Feb 28, 2019
2 parents eb7e074 + 2d95d7d commit efb68fb
Show file tree
Hide file tree
Showing 47 changed files with 1,080 additions and 526 deletions.
11 changes: 11 additions & 0 deletions RESOURCES.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# Resources

This a list of attributions and giving credit to the sources and inspiration for various elements of this project

## Images

### Icons

<img style="background: white;" src="./Templates/StreamDeck.PluginTemplate.Csharp/content/images/[email protected]" /><br />
[plugin by Galaktionoff from the Noun Project](https://thenounproject.com/search/?q=plugin&i=1692300#)

Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,8 @@
"datatype": "string",
"description": "The name of the stream deck plugin.",
"defaultValue": "MyPlugin",
"replaces": "$(PluginName)"
"replaces": "$(PluginName)",
"fileRename": "_PluginName_"
},
"uuid": {
"type": "parameter",
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
using StreamDeckLib;
using StreamDeckLib.Messages;
using System;
using System.Collections.Generic;
using System.Text;
using System.Threading.Tasks;

namespace _StreamDeckPlugin_
{
[ActionUuid(Uuid="$(UUID)")]
public class $(PluginName)Action : BaseStreamDeckActionWithSettingsModel<Models.CounterSettingsModel>
{
// Cheer 342 cpayette 15/2/19
// Cheer 100 devlead 15/2/19
// Cheer 200 kevin_downs Jan 11, 2019
// Cheer 401 cpayette Jan 15, 2019
// Cheer 2501 themikejolley Jan 15, 2019
// Cheer 100 wolfgang_blitz Jan 15, 2019
// Cheer 157 jongalloway Jan 15, 2019
// Cheer 100 johanb Jan 15, 2019
// Cheer 400 faniereynders Jan 15, 2019
// Cheer 100 TomMcQ Jan 15, 2019
// Cheer 361 Crazy240sx Jan 15, 2019
// Cheer 600 yarrgh Jan 15, 2019
// Cheer 1030 kulu83 Jan 15, 2019
// Cheer 2500 Auth0Bobby Jan 15, 2019

public override async Task OnKeyUp(StreamDeckEventPayload args)
{
SettingsModel.Counter++;
await Manager.SetTitleAsync(args.context, SettingsModel.Counter.ToString());

if (SettingsModel.Counter % 10 == 0)
{
await Manager.ShowAlertAsync(args.context);
}
else if (SettingsModel.Counter % 15 == 0)
{
await Manager.OpenUrlAsync(args.context, "https://www.bing.com");
}
else if (SettingsModel.Counter % 3 == 0)
{
await Manager.ShowOkAsync(args.context);
}
else if (SettingsModel.Counter % 7 == 0)
{
await Manager.SetImageAsync(args.context, "images/Fritz.png");
}

//update settings
await Manager.SetSettingsAsync(args.context, SettingsModel);
}

public override async Task OnDidReceiveSettings(StreamDeckEventPayload args)
{
await base.OnDidReceiveSettings(args);
await Manager.SetTitleAsync(args.context, SettingsModel.Counter.ToString());
}

public override async Task OnWillAppear(StreamDeckEventPayload args)
{
await base.OnWillAppear(args);
await Manager.SetTitleAsync(args.context, SettingsModel.Counter.ToString());
}

}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
cd %appdata%\Elgato\StreamDeck\Plugins\$(UUID)
_StreamDeckPlugin_.exe -break %*
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,33 @@
<Content Include="images/[email protected]">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="images/Fritz.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
</ItemGroup>

<!-- Property Inspector Files -->
<ItemGroup>
<Content Include="property_inspector\css\property-inspector.css">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="property_inspector\css\sdpi.css">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="property_inspector\js\property-inspector.js">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="property_inspector\property_inspector.html">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>

</ItemGroup>

<!-- Build Helper -->
<ItemGroup>
<Content Include="_StreamDeckPlugin_.cmd">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
</ItemGroup>

<!-- Include the README.md as part of the project for easy reference -->
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
13 changes: 10 additions & 3 deletions Templates/StreamDeck.PluginTemplate.Csharp/content/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"Actions": [
{
"Icon": "images/actionIcon",
"Name": "$(PluginName)",
"Name": "$(PluginName)Action",
"States": [
{
"Image": "images/actionDefaultImage",
Expand All @@ -15,7 +15,10 @@
"UUID": "$(UUID).DefaultPluginAction"
}
],
"Author": "",
"Category": "Your Plugin Category",
"CategoryIcon": "images/category/categoryIcon.png",
"Disabled": false,
"Author": "Your Name",
"CodePathWin": "_StreamDeckPlugin_.exe",
"CodePathMac": "_StreamDeckPlugin_",
"PropertyInspectorPath": "property_inspector/property_inspector.html",
Expand All @@ -24,7 +27,11 @@
"Icon": "images/pluginIcon",
"URL": "https://www.elgato.com/gaming/stream-deck",
"Version": "1.0",
"OS": [
"SDKVersion": 2,
"Software": {
"MinimumVersion": "4.1"
},
"OS": [
{
"Platform": "mac",
"MinimumVersion" : "10.11"
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
namespace _StreamDeckPlugin_.Models
{
public class CounterSettingsModel
{
public int Counter { get; set; } = 0;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,39 +2,60 @@
// as well as some info about our plugin, as sent by Stream Deck software
var websocket = null,
uuid = null,
inInfo = null,
actionInfo = {};
inInfo = null,
actionInfo = {},
settingsModel = {
Counter: 0
};

function connectSocket(inPort, inUUID, inRegisterEvent, inInfo, inActionInfo) {
function connectElgatoStreamDeckSocket(inPort, inUUID, inRegisterEvent, inInfo, inActionInfo) {
uuid = inUUID;
actionInfo = JSON.parse(inActionInfo);
inInfo = JSON.parse(inInfo);
websocket = new WebSocket('ws://localhost:' + inPort);

//initialize values
if (actionInfo.payload.settings.settingsModel) {
settingsModel.Counter = actionInfo.payload.settings.settingsModel.Counter;
}

document.getElementById('txtCounterValue').value = settingsModel.Counter;

websocket.onopen = function () {
var json = { event: inRegisterEvent, uuid: inUUID };
// register property inspector to Stream Deck
websocket.send(JSON.stringify(json));
sendValueToPlugin('propertyInspectorConnected', 'property_inspector');
};
}
var json = { event: inRegisterEvent, uuid: inUUID };
// register property inspector to Stream Deck
websocket.send(JSON.stringify(json));

window.addEventListener('unload', function (event) {
sendValueToPlugin('propertyInspectorDisconnected', 'property_inspector');
});
};

function sendValueToPlugin(value, param) {
if (websocket) {
const json = {
"action": actionInfo['action'],
"event": "sendToPlugin",
"context": uuid,
"payload": {
[param]: value
}
};
websocket.send(JSON.stringify(json));
websocket.onmessage = function (evt) {
// Received message from Stream Deck
var jsonObj = JSON.parse(evt.data);
var sdEvent = jsonObj['event'];
switch (sdEvent) {
case "didReceiveSettings":
if (jsonObj.payload.settings.settingsModel.Counter) {
settingsModel.Counter = jsonObj.payload.settings.settingsModel.Counter;
document.getElementById('txtCounterValue').value = settingsModel.Counter;
}
break;
default:
break;
}
};
}

const setSettings = (value, param) => {
if (websocket) {
settingsModel[param] = value;
var json = {
"event": "setSettings",
"context": uuid,
"payload": {
"settingsModel": settingsModel
}
};
websocket.send(JSON.stringify(json));
}
};

Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@
Elgato SDK Documentation -> https://developer.elgato.com/documentation/stream-deck/sdk/property-inspector/
-->

<div class="sdpi-item" id="starting_number">
<div class="sdpi-item-label">Starting Number</div>
<input class="sdpi-item-value" type="number" inputmode="numeric" pattern="[0-9]*" onchange="sendValueToPlugin(event.target.value, 'starting_number')" />
<div class="sdpi-item" id="counter_value">
<div class="sdpi-item-label">Counter Value</div>
<input id="txtCounterValue" class="sdpi-item-value" type="number" inputmode="numeric" pattern="[0-9]*" placeholder="Enter counter number" onchange="setSettings(event.target.value, 'Counter')" />
</div>

</div>
Expand Down
Loading

0 comments on commit efb68fb

Please sign in to comment.