diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml
index 8d64409..10773dc 100644
--- a/.github/workflows/build.yaml
+++ b/.github/workflows/build.yaml
@@ -42,12 +42,12 @@ jobs:
- uses: actions/checkout@v2
- name: Setup .NET Core SDK
- uses: actions/setup-dotnet@v1.8.1
+ uses: actions/setup-dotnet@v4
with:
- dotnet-version: 5.0.x
+ dotnet-version: 9.0.x
- name: Restore
run: dotnet restore
- name: Build
- run: dotnet build --configuration Release --no-restore
\ No newline at end of file
+ run: dotnet build --configuration Release --no-restore
diff --git a/README.md b/README.md
index eeb958a..9845863 100644
--- a/README.md
+++ b/README.md
@@ -15,9 +15,11 @@
[](https://den.dev/ukraine)
-## How It Works
+## Setup & operation
-To get started, it's necessary to create a new profile, with a set of commands that will be associated with a button on the Stream Deck. To do that, you can use the `write` command in the Piglet CLI.
+### Creating a new profile
+
+To get started, it's necessary to **create a new profile**, with a set of commands that will be associated with a button on the Stream Deck. To do that, you can use the `write` command in the Piglet CLI.
```bash
Usage:
@@ -47,7 +49,15 @@ The following arguments are used, and are required:
| `--action-args` or `-a` | Arguments to pass to the command being executed. This string is specific to each command. |
| `--profile` or `-p` | The name of the profile to be used. If no profile with a given name exists, a new one will be created. |
-The created profile will be located in `%LOCALAPPDATA%\DenDev\{PROFILE_NAME}`. The settings are stored in a `profile.json` file within the profile folder.
+The created profile will be located in `%LOCALAPPDATA%\Den.Dev\DeckSurf\{PROFILE_NAME}`. The settings are stored in a `profile.json` file within the profile folder.
+
+### Listing existing devices
+
+To list existing devices, run:
+
+```powershell
+deck list
+```
## FAQ
diff --git a/src/DeckSurf/DeckSurf.Plugin.Barn/Commands/LaunchApplication.cs b/src/DeckSurf/DeckSurf.Plugin.Barn/Commands/LaunchApplication.cs
index ad2c282..9df12a2 100644
--- a/src/DeckSurf/DeckSurf.Plugin.Barn/Commands/LaunchApplication.cs
+++ b/src/DeckSurf/DeckSurf.Plugin.Barn/Commands/LaunchApplication.cs
@@ -1,5 +1,4 @@
-using DeckSurf.SDK.Core;
-using DeckSurf.SDK.Interfaces;
+using DeckSurf.SDK.Interfaces;
using DeckSurf.SDK.Models;
using DeckSurf.SDK.Util;
using System.Diagnostics;
@@ -23,11 +22,11 @@ public void ExecuteOnActivation(CommandMapping mappedCommand, ConnectedDevice ma
{
try
{
- var icon = ImageHelpers.GetFileIcon(mappedCommand.CommandArguments, DeviceConstants.XLButtonSize, DeviceConstants.XLButtonSize, SIIGBF.SIIGBF_ICONONLY | SIIGBF.SIIGBF_CROPTOSQUARE);
+ var icon = ImageHelpers.GetFileIcon(mappedCommand.CommandArguments, mappedDevice.ButtonResolution, mappedDevice.ButtonResolution, SIIGBF.SIIGBF_ICONONLY | SIIGBF.SIIGBF_CROPTOSQUARE);
var byteContent = ImageHelpers.GetImageBuffer(icon);
// TODO: Make sure that this works beyond the XL model.
- var resizedByteContent = ImageHelpers.ResizeImage(byteContent, DeviceConstants.XLButtonSize, DeviceConstants.XLButtonSize);
+ var resizedByteContent = ImageHelpers.ResizeImage(byteContent, mappedDevice.ButtonResolution, mappedDevice.ButtonResolution, mappedDevice.IsButtonImageFlipRequired);
mappedDevice.SetKey(mappedCommand.ButtonIndex, resizedByteContent);
}
catch
diff --git a/src/DeckSurf/DeckSurf.Plugin.Barn/Commands/ShowCPUUsage.cs b/src/DeckSurf/DeckSurf.Plugin.Barn/Commands/ShowCPUUsage.cs
index f23126b..901d4da 100644
--- a/src/DeckSurf/DeckSurf.Plugin.Barn/Commands/ShowCPUUsage.cs
+++ b/src/DeckSurf/DeckSurf.Plugin.Barn/Commands/ShowCPUUsage.cs
@@ -31,7 +31,7 @@ public void ExecuteOnActivation(CommandMapping mappedCommand, ConnectedDevice ma
cpuUsageTimer.Elapsed += (s, e) =>
{
var randomIconFromText = IconGenerator.GenerateTestImageFromText(GetCPUUsage().ToString() + "%", new Font("Bahnschrift", 94), Color.Red, Color.Black);
- var resizeImage = ImageHelpers.ResizeImage(ImageHelpers.GetImageBuffer(randomIconFromText), DeviceConstants.XLButtonSize, DeviceConstants.XLButtonSize);
+ var resizeImage = ImageHelpers.ResizeImage(ImageHelpers.GetImageBuffer(randomIconFromText), mappedDevice.ButtonResolution, mappedDevice.ButtonResolution, mappedDevice.IsButtonImageFlipRequired);
mappedDevice.SetKey(mappedCommand.ButtonIndex, resizeImage);
};
diff --git a/src/DeckSurf/DeckSurf.Plugin.Barn/Commands/SnakeGame.cs b/src/DeckSurf/DeckSurf.Plugin.Barn/Commands/SnakeGame.cs
index 66e1c0b..685a4d2 100644
--- a/src/DeckSurf/DeckSurf.Plugin.Barn/Commands/SnakeGame.cs
+++ b/src/DeckSurf/DeckSurf.Plugin.Barn/Commands/SnakeGame.cs
@@ -1,8 +1,9 @@
-using DeckSurf.SDK.Core;
-using DeckSurf.SDK.Interfaces;
+using DeckSurf.SDK.Interfaces;
using DeckSurf.SDK.Models;
+using DeckSurf.SDK.Util;
using System.Collections.Generic;
using System.Diagnostics;
+using System.Drawing;
using System.Timers;
namespace DeckSurf.Plugin.Barn.Commands
@@ -72,13 +73,13 @@ public void ExecuteOnAction(CommandMapping mappedCommand, ConnectedDevice mapped
public void ExecuteOnActivation(CommandMapping mappedCommand, ConnectedDevice mappedDevice)
{
- mappedDevice.ClearPanel();
+ mappedDevice.ClearButtons();
UpdateSnakeRendering(mappedDevice);
Timer timer = new(1000);
timer.Elapsed += (s, e) =>
{
- mappedDevice.SetKey(UpdateSnakePosition(_direction), DeviceConstants.XLDefaultBlackButton);
+ mappedDevice.SetKey(UpdateSnakePosition(_direction), ImageHelpers.CreateBlankImage(mappedDevice.ButtonResolution, Color.Black));
UpdateSnakeRendering(mappedDevice);
};
timer.Start();
@@ -121,7 +122,7 @@ private void UpdateSnakeRendering(ConnectedDevice mappedDevice)
{
foreach (var snakeNode in _snake)
{
- mappedDevice.SetKey(snakeNode, DeviceConstants.XLDefaultWhiteButton);
+ mappedDevice.SetKey(snakeNode, ImageHelpers.CreateBlankImage(mappedDevice.ButtonResolution, Color.White));
}
}
}
diff --git a/src/DeckSurf/DeckSurf.Plugin.Barn/DeckSurf.Plugin.Barn.csproj b/src/DeckSurf/DeckSurf.Plugin.Barn/DeckSurf.Plugin.Barn.csproj
index 896cfd5..ed77e64 100644
--- a/src/DeckSurf/DeckSurf.Plugin.Barn/DeckSurf.Plugin.Barn.csproj
+++ b/src/DeckSurf/DeckSurf.Plugin.Barn/DeckSurf.Plugin.Barn.csproj
@@ -1,7 +1,7 @@
- net5.0
+ net9.0
x64
false
false
@@ -18,8 +18,8 @@
-
-
+
+
diff --git a/src/DeckSurf/DeckSurf/DeckSurf.csproj b/src/DeckSurf/DeckSurf/DeckSurf.csproj
index 472a474..e836e99 100644
--- a/src/DeckSurf/DeckSurf/DeckSurf.csproj
+++ b/src/DeckSurf/DeckSurf/DeckSurf.csproj
@@ -2,13 +2,13 @@
Exe
- net5.0
+ net9.0
x64
false
piglet.ico
Den Delimarsky
- 0.0.1
- 2021 by Den Delimarsky. All rights reserved.
+ 0.0.2
+ Copyright © 2024 by Den Delimarsky. All rights reserved.
deck
@@ -21,8 +21,8 @@
-
-
+
+
diff --git a/src/DeckSurf/DeckSurf/Program.cs b/src/DeckSurf/DeckSurf/Program.cs
index eaeb351..cc97cac 100644
--- a/src/DeckSurf/DeckSurf/Program.cs
+++ b/src/DeckSurf/DeckSurf/Program.cs
@@ -34,7 +34,7 @@ private static Task SetupCommandLine(string[] args)
};
writeCommand.AddOption(new Option(
- aliases: new[] { "--device-index", "-d" },
+ aliases: ["--device-index", "-d"],
getDefaultValue: () => -1,
description: "Index of the connected device, to which a key setting should be written.")
{
@@ -43,7 +43,7 @@ private static Task SetupCommandLine(string[] args)
});
writeCommand.AddOption(new Option(
- aliases: new[] { "--key-index", "-k" },
+ aliases: ["--key-index", "-k"],
getDefaultValue: () => -1,
description: "Index of the key that needs to be written.")
{
@@ -52,7 +52,7 @@ private static Task SetupCommandLine(string[] args)
});
writeCommand.AddOption(new Option(
- aliases: new[] { "--plugin", "-l" },
+ aliases: ["--plugin", "-l"],
getDefaultValue: () => string.Empty,
description: "Plugin that contains the relevant command.")
{
@@ -61,7 +61,7 @@ private static Task SetupCommandLine(string[] args)
});
writeCommand.AddOption(new Option(
- aliases: new[] { "--command", "-c" },
+ aliases: ["--command", "-c"],
getDefaultValue: () => string.Empty,
description: "Command to be executed.")
{
@@ -70,7 +70,7 @@ private static Task SetupCommandLine(string[] args)
});
writeCommand.AddOption(new Option(
- aliases: new[] { "--image-path", "-i" },
+ aliases: ["--image-path", "-i"],
getDefaultValue: () => string.Empty,
description: "Path to the default image for the button.")
{
@@ -79,7 +79,7 @@ private static Task SetupCommandLine(string[] args)
});
writeCommand.AddOption(new Option(
- aliases: new[] { "--action-args", "-g" },
+ aliases: ["--action-args", "-g"],
getDefaultValue: () => string.Empty,
description: "Arguments for the defined action.")
{
@@ -88,7 +88,7 @@ private static Task SetupCommandLine(string[] args)
});
writeCommand.AddOption(new Option(
- aliases: new[] { "--profile", "-p" },
+ aliases: ["--profile", "-p"],
getDefaultValue: () => string.Empty,
description: "The profile to which the command should be added.")
{
@@ -114,7 +114,7 @@ private static Task SetupCommandLine(string[] args)
Handler = CommandHandler.Create(HandleListenCommand)
};
listenCommand.AddOption(new Option(
- aliases: new[] { "--profile", "-p" },
+ aliases: ["--profile", "-p"],
getDefaultValue: () => string.Empty,
description: "The profile associated with the current device.")
{
@@ -155,9 +155,9 @@ private static void HandleListenCommand(string profile)
device.OnButtonPress += (s, e) =>
{
- Console.WriteLine($"Button {e.Id} pressed. Event type: {e.Kind}");
+ Console.WriteLine($"Button {e.Id} pressed. Event type: {e.EventKind}");
- if (e.Kind == ButtonEventKind.DOWN)
+ if (e.EventKind == ButtonEventKind.DOWN)
{
var buttonEntry = workingProfile.ButtonMap.FirstOrDefault(x => x.ButtonIndex == e.Id);
if (buttonEntry != null)
@@ -188,7 +188,7 @@ private static void HandleListenCommand(string profile)
}
_commands = new Dictionary>(commandMap);
- device.InitializeDevice();
+ device.StartListening();
foreach(var mappedButton in workingProfile.ButtonMap)
{
@@ -229,11 +229,11 @@ private static void ExecuteButtonAction(CommandMapping buttonEntry, ConnectedDev
private static void HandleListCommand()
{
var devices = DeviceManager.GetDeviceList();
- Console.WriteLine($"{"| Device Name",-21} {"| VID",-10} {"| PID",-10}");
+ Console.WriteLine($"{"| Device Name",-21} {"| VID",-10} {"| PID",-10} {"| Serial Number",-10}");
Console.WriteLine("===========================================");
foreach (var device in devices)
{
- Console.WriteLine($"{"| " + device.Name,-21} {"| " + device.VId,-10} {"| " + device.PId,-10}");
+ Console.WriteLine($"{"| " + device.Name,-21} {"| " + device.VId,-10} {"| " + $"0x{((int)device.Model):X}",-10} {"| " + device.Serial ,-10}");
}
}