From 61448131ed035c40658c5802712083adf7d2b22e Mon Sep 17 00:00:00 2001 From: "Jeffrey T. Fritz" Date: Tue, 19 Feb 2019 21:19:55 -0500 Subject: [PATCH 1/6] Fixed Config references to ExecutingAssembly (#128) * Small Powershell Fix (#88) * commented out starting of the stream deck app - this is handled in the Debug -> Application Arguments * Fixed the Fritz.png error * restored the osx post build script and added detailed comments (#90) * Updates to the Powershell script (#98) * Refactored to an Proxy interface to address #47 * Added remaining EventsSent to ConfigurationManager * Attempting to eliminate memory leak * Adding script to test the Plugin template * WIP * Updated to be more cross-platform friendly * Re-added cheer graffiti * Prevent displaying errors in PowerShell script to the user (#93) * bugfix/Silence-non-critical-PowerShell-errors: Prevent displaying errors for operations which can expectedly fail * bugfix/Silence-non-critical-PowerShell-errors: Make the template's .ps1 file match the sample * bugfix/Update-gitignore-with-VSCode-files: Add ignorables for VSCode (#94) * Feature/sample property inspector (#95) * work in progress - sample property inspector * worked through intricacies of the deserialized dynamic payload * Updated Templates * Attempt to fix the template test (#100) * Refactored to an Proxy interface to address #47 * Added remaining EventsSent to ConfigurationManager * Attempting to eliminate memory leak * Adding script to test the Plugin template * WIP * Updated to be more cross-platform friendly * Re-added cheer graffiti * Added a no-restore directive to the testTemplate script * Released (#104) * Release (#101) * Small Powershell Fix (#88) * commented out starting of the stream deck app - this is handled in the Debug -> Application Arguments * Fixed the Fritz.png error * restored the osx post build script and added detailed comments (#90) * Updates to the Powershell script (#98) * Refactored to an Proxy interface to address #47 * Added remaining EventsSent to ConfigurationManager * Attempting to eliminate memory leak * Adding script to test the Plugin template * WIP * Updated to be more cross-platform friendly * Re-added cheer graffiti * Prevent displaying errors in PowerShell script to the user (#93) * bugfix/Silence-non-critical-PowerShell-errors: Prevent displaying errors for operations which can expectedly fail * bugfix/Silence-non-critical-PowerShell-errors: Make the template's .ps1 file match the sample * bugfix/Update-gitignore-with-VSCode-files: Add ignorables for VSCode (#94) * Feature/sample property inspector (#95) * work in progress - sample property inspector * worked through intricacies of the deserialized dynamic payload * Updated Templates * Attempt to fix the template test (#100) * Refactored to an Proxy interface to address #47 * Added remaining EventsSent to ConfigurationManager * Attempting to eliminate memory leak * Adding script to test the Plugin template * WIP * Updated to be more cross-platform friendly * Re-added cheer graffiti * Release with fix to testTemplate (#103) * Small Powershell Fix (#88) * commented out starting of the stream deck app - this is handled in the Debug -> Application Arguments * Fixed the Fritz.png error * restored the osx post build script and added detailed comments (#90) * Updates to the Powershell script (#98) * Refactored to an Proxy interface to address #47 * Added remaining EventsSent to ConfigurationManager * Attempting to eliminate memory leak * Adding script to test the Plugin template * WIP * Updated to be more cross-platform friendly * Re-added cheer graffiti * Prevent displaying errors in PowerShell script to the user (#93) * bugfix/Silence-non-critical-PowerShell-errors: Prevent displaying errors for operations which can expectedly fail * bugfix/Silence-non-critical-PowerShell-errors: Make the template's .ps1 file match the sample * bugfix/Update-gitignore-with-VSCode-files: Add ignorables for VSCode (#94) * Feature/sample property inspector (#95) * work in progress - sample property inspector * worked through intricacies of the deserialized dynamic payload * Updated Templates * Attempt to fix the template test (#100) * Refactored to an Proxy interface to address #47 * Added remaining EventsSent to ConfigurationManager * Attempting to eliminate memory leak * Adding script to test the Plugin template * WIP * Updated to be more cross-platform friendly * Re-added cheer graffiti * Added a no-restore directive to the testTemplate script * extraneous $bindir concatenation causing issues with copying of files - removed that line of code so it copies over properly (#105) * introduced a view model in js to support multiple field property inspectors (#108) * [WIP] Proposal: Refactor Registration Scripts (#110) * migrating registration scripts to a central spot shared by all projects * adding a .gitattributes to prevent cross platform whitespace munging as well as some merge hinting * fix to always pull from current working directory, added logic to pull the csproj file from the working directory as well by file type rather than by name * introduced the most recent powershell changes into this version of the script * this could be a white space issue. * Move plugin logic into action classes (#111) * Add a method to immediately attach a debugger before any functional code has run. * Make changes so that a plugin can support multiple actions Add and throw exceptions for validating actions Convert "MySamplePlugin" to be an action/handler Refactor cancellation token and add ConnectionManager unit tests * Fix build errors from merge misses Mark refactored classes and methods with the "Obsolete" attribute for now. * Update the template to reflect the changes in the SamplePlugin Use the new BaseStreamDeckAction class Update the README with information on creating a new action * Fixed missing method that got dropped during merge * Addressed logger and memory leak issues #73 #114 (#117) * Refactored to an Proxy interface to address #47 * Added remaining EventsSent to ConfigurationManager * Attempting to eliminate memory leak * Adding script to test the Plugin template * WIP * Updated to be more cross-platform friendly * Re-added cheer graffiti * Cleaning up the inner-loop build-debug-process * Addressed logger and memory leak issues #73 #114 * Added Default Configuration Builder (#118) * Refactored to an Proxy interface to address #47 * Added remaining EventsSent to ConfigurationManager * Attempting to eliminate memory leak * Adding script to test the Plugin template * WIP * Updated to be more cross-platform friendly * Re-added cheer graffiti * Cleaning up the inner-loop build-debug-process * Addressed logger and memory leak issues #73 #114 * Added a default configuration builder #34 Addressed logger and memory leak issues #73 #114 (#117) * Refactored to an Proxy interface to address #47 * Added remaining EventsSent to ConfigurationManager * Attempting to eliminate memory leak * Adding script to test the Plugin template * WIP * Updated to be more cross-platform friendly * Re-added cheer graffiti * Cleaning up the inner-loop build-debug-process * Addressed logger and memory leak issues #73 #114 * Added UUID constructor to fix #119 (#121) * Refactored to an Proxy interface to address #47 * Added remaining EventsSent to ConfigurationManager * Attempting to eliminate memory leak * Adding script to test the Plugin template * WIP * Updated to be more cross-platform friendly * Re-added cheer graffiti * Cleaning up the inner-loop build-debug-process * Addressed logger and memory leak issues #73 #114 * Added a default configuration builder #34 Addressed logger and memory leak issues #73 #114 (#117) * Refactored to an Proxy interface to address #47 * Added remaining EventsSent to ConfigurationManager * Attempting to eliminate memory leak * Adding script to test the Plugin template * WIP * Updated to be more cross-platform friendly * Re-added cheer graffiti * Cleaning up the inner-loop build-debug-process * Addressed logger and memory leak issues #73 #114 * Fixed some tests, added UUID constructor for #119 * Added a 'RegisterAllActions' feature to the ConnectionManager (#122) * Refactored to an Proxy interface to address #47 * Added remaining EventsSent to ConfigurationManager * Attempting to eliminate memory leak * Adding script to test the Plugin template * WIP * Updated to be more cross-platform friendly * Re-added cheer graffiti * Cleaning up the inner-loop build-debug-process * Addressed logger and memory leak issues #73 #114 * Added a default configuration builder #34 Addressed logger and memory leak issues #73 #114 (#117) * Refactored to an Proxy interface to address #47 * Added remaining EventsSent to ConfigurationManager * Attempting to eliminate memory leak * Adding script to test the Plugin template * WIP * Updated to be more cross-platform friendly * Re-added cheer graffiti * Cleaning up the inner-loop build-debug-process * Addressed logger and memory leak issues #73 #114 * Fixed some tests, added UUID constructor for #119 * Added a 'RegisterAllActions' feature to the ConnectionManager * Fixed configuration to use the current executing assembly (#127) * Refactored to an Proxy interface to address #47 * Added remaining EventsSent to ConfigurationManager * Attempting to eliminate memory leak * Adding script to test the Plugin template * WIP * Updated to be more cross-platform friendly * Re-added cheer graffiti * Cleaning up the inner-loop build-debug-process * Addressed logger and memory leak issues #73 #114 * Added a default configuration builder #34 Addressed logger and memory leak issues #73 #114 (#117) * Refactored to an Proxy interface to address #47 * Added remaining EventsSent to ConfigurationManager * Attempting to eliminate memory leak * Adding script to test the Plugin template * WIP * Updated to be more cross-platform friendly * Re-added cheer graffiti * Cleaning up the inner-loop build-debug-process * Addressed logger and memory leak issues #73 #114 * Fixed some tests, added UUID constructor for #119 * Added a 'RegisterAllActions' feature to the ConnectionManager * Updated to properly configure current folder --- src/StreamDeckLib.Config/ConfigurationBuilder.cs | 4 ++-- src/StreamDeckLib/ConnectionManager.cs | 4 ++++ 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/StreamDeckLib.Config/ConfigurationBuilder.cs b/src/StreamDeckLib.Config/ConfigurationBuilder.cs index b81560c..963cdcd 100644 --- a/src/StreamDeckLib.Config/ConfigurationBuilder.cs +++ b/src/StreamDeckLib.Config/ConfigurationBuilder.cs @@ -1,4 +1,4 @@ -using Microsoft.Extensions.Configuration; +using Microsoft.Extensions.Configuration; using Microsoft.Extensions.Logging; using Serilog; using System; @@ -39,7 +39,7 @@ private ConfigurationBuilder(string[] args) { public static ConfigurationBuilder BuildDefaultConfiguration(string[] args) { - var dir = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location); + var dir = Path.GetDirectoryName(Assembly.GetEntryAssembly().Location); Directory.SetCurrentDirectory(dir); var configuration = new CONFIG.ConfigurationBuilder() diff --git a/src/StreamDeckLib/ConnectionManager.cs b/src/StreamDeckLib/ConnectionManager.cs index 1fbaa76..de3bf91 100644 --- a/src/StreamDeckLib/ConnectionManager.cs +++ b/src/StreamDeckLib/ConnectionManager.cs @@ -4,6 +4,7 @@ using Newtonsoft.Json; using StreamDeckLib.Messages; using System; +using System.Diagnostics; using System.IO; using System.Linq; using System.Net.WebSockets; @@ -231,6 +232,9 @@ public async Task SetTitleAsync(string context, string newTitle) public async Task SetImageAsync(string context, string imageLocation) { + Debug.WriteLine($"Getting Image from {new FileInfo(imageLocation).FullName} on disk"); + _Logger.LogDebug($"Getting Image from {new FileInfo(imageLocation).FullName} on disk"); + var imgString = Convert.ToBase64String(File.ReadAllBytes(imageLocation), Base64FormattingOptions.None); var args = new SetImageArgs From 8fa7316481e60fbb1136cec056d4755341a88e12 Mon Sep 17 00:00:00 2001 From: "Jeffrey T. Fritz" Date: Tue, 19 Feb 2019 22:43:50 -0500 Subject: [PATCH 2/6] Release test project fix (#130) * Small Powershell Fix (#88) * commented out starting of the stream deck app - this is handled in the Debug -> Application Arguments * Fixed the Fritz.png error * restored the osx post build script and added detailed comments (#90) * Updates to the Powershell script (#98) * Refactored to an Proxy interface to address #47 * Added remaining EventsSent to ConfigurationManager * Attempting to eliminate memory leak * Adding script to test the Plugin template * WIP * Updated to be more cross-platform friendly * Re-added cheer graffiti * Prevent displaying errors in PowerShell script to the user (#93) * bugfix/Silence-non-critical-PowerShell-errors: Prevent displaying errors for operations which can expectedly fail * bugfix/Silence-non-critical-PowerShell-errors: Make the template's .ps1 file match the sample * bugfix/Update-gitignore-with-VSCode-files: Add ignorables for VSCode (#94) * Feature/sample property inspector (#95) * work in progress - sample property inspector * worked through intricacies of the deserialized dynamic payload * Updated Templates * Attempt to fix the template test (#100) * Refactored to an Proxy interface to address #47 * Added remaining EventsSent to ConfigurationManager * Attempting to eliminate memory leak * Adding script to test the Plugin template * WIP * Updated to be more cross-platform friendly * Re-added cheer graffiti * Added a no-restore directive to the testTemplate script * Released (#104) * Release (#101) * Small Powershell Fix (#88) * commented out starting of the stream deck app - this is handled in the Debug -> Application Arguments * Fixed the Fritz.png error * restored the osx post build script and added detailed comments (#90) * Updates to the Powershell script (#98) * Refactored to an Proxy interface to address #47 * Added remaining EventsSent to ConfigurationManager * Attempting to eliminate memory leak * Adding script to test the Plugin template * WIP * Updated to be more cross-platform friendly * Re-added cheer graffiti * Prevent displaying errors in PowerShell script to the user (#93) * bugfix/Silence-non-critical-PowerShell-errors: Prevent displaying errors for operations which can expectedly fail * bugfix/Silence-non-critical-PowerShell-errors: Make the template's .ps1 file match the sample * bugfix/Update-gitignore-with-VSCode-files: Add ignorables for VSCode (#94) * Feature/sample property inspector (#95) * work in progress - sample property inspector * worked through intricacies of the deserialized dynamic payload * Updated Templates * Attempt to fix the template test (#100) * Refactored to an Proxy interface to address #47 * Added remaining EventsSent to ConfigurationManager * Attempting to eliminate memory leak * Adding script to test the Plugin template * WIP * Updated to be more cross-platform friendly * Re-added cheer graffiti * Release with fix to testTemplate (#103) * Small Powershell Fix (#88) * commented out starting of the stream deck app - this is handled in the Debug -> Application Arguments * Fixed the Fritz.png error * restored the osx post build script and added detailed comments (#90) * Updates to the Powershell script (#98) * Refactored to an Proxy interface to address #47 * Added remaining EventsSent to ConfigurationManager * Attempting to eliminate memory leak * Adding script to test the Plugin template * WIP * Updated to be more cross-platform friendly * Re-added cheer graffiti * Prevent displaying errors in PowerShell script to the user (#93) * bugfix/Silence-non-critical-PowerShell-errors: Prevent displaying errors for operations which can expectedly fail * bugfix/Silence-non-critical-PowerShell-errors: Make the template's .ps1 file match the sample * bugfix/Update-gitignore-with-VSCode-files: Add ignorables for VSCode (#94) * Feature/sample property inspector (#95) * work in progress - sample property inspector * worked through intricacies of the deserialized dynamic payload * Updated Templates * Attempt to fix the template test (#100) * Refactored to an Proxy interface to address #47 * Added remaining EventsSent to ConfigurationManager * Attempting to eliminate memory leak * Adding script to test the Plugin template * WIP * Updated to be more cross-platform friendly * Re-added cheer graffiti * Added a no-restore directive to the testTemplate script * extraneous $bindir concatenation causing issues with copying of files - removed that line of code so it copies over properly (#105) * introduced a view model in js to support multiple field property inspectors (#108) * [WIP] Proposal: Refactor Registration Scripts (#110) * migrating registration scripts to a central spot shared by all projects * adding a .gitattributes to prevent cross platform whitespace munging as well as some merge hinting * fix to always pull from current working directory, added logic to pull the csproj file from the working directory as well by file type rather than by name * introduced the most recent powershell changes into this version of the script * this could be a white space issue. * Move plugin logic into action classes (#111) * Add a method to immediately attach a debugger before any functional code has run. * Make changes so that a plugin can support multiple actions Add and throw exceptions for validating actions Convert "MySamplePlugin" to be an action/handler Refactor cancellation token and add ConnectionManager unit tests * Fix build errors from merge misses Mark refactored classes and methods with the "Obsolete" attribute for now. * Update the template to reflect the changes in the SamplePlugin Use the new BaseStreamDeckAction class Update the README with information on creating a new action * Fixed missing method that got dropped during merge * Addressed logger and memory leak issues #73 #114 (#117) * Refactored to an Proxy interface to address #47 * Added remaining EventsSent to ConfigurationManager * Attempting to eliminate memory leak * Adding script to test the Plugin template * WIP * Updated to be more cross-platform friendly * Re-added cheer graffiti * Cleaning up the inner-loop build-debug-process * Addressed logger and memory leak issues #73 #114 * Added Default Configuration Builder (#118) * Refactored to an Proxy interface to address #47 * Added remaining EventsSent to ConfigurationManager * Attempting to eliminate memory leak * Adding script to test the Plugin template * WIP * Updated to be more cross-platform friendly * Re-added cheer graffiti * Cleaning up the inner-loop build-debug-process * Addressed logger and memory leak issues #73 #114 * Added a default configuration builder #34 Addressed logger and memory leak issues #73 #114 (#117) * Refactored to an Proxy interface to address #47 * Added remaining EventsSent to ConfigurationManager * Attempting to eliminate memory leak * Adding script to test the Plugin template * WIP * Updated to be more cross-platform friendly * Re-added cheer graffiti * Cleaning up the inner-loop build-debug-process * Addressed logger and memory leak issues #73 #114 * Added UUID constructor to fix #119 (#121) * Refactored to an Proxy interface to address #47 * Added remaining EventsSent to ConfigurationManager * Attempting to eliminate memory leak * Adding script to test the Plugin template * WIP * Updated to be more cross-platform friendly * Re-added cheer graffiti * Cleaning up the inner-loop build-debug-process * Addressed logger and memory leak issues #73 #114 * Added a default configuration builder #34 Addressed logger and memory leak issues #73 #114 (#117) * Refactored to an Proxy interface to address #47 * Added remaining EventsSent to ConfigurationManager * Attempting to eliminate memory leak * Adding script to test the Plugin template * WIP * Updated to be more cross-platform friendly * Re-added cheer graffiti * Cleaning up the inner-loop build-debug-process * Addressed logger and memory leak issues #73 #114 * Fixed some tests, added UUID constructor for #119 * Added a 'RegisterAllActions' feature to the ConnectionManager (#122) * Refactored to an Proxy interface to address #47 * Added remaining EventsSent to ConfigurationManager * Attempting to eliminate memory leak * Adding script to test the Plugin template * WIP * Updated to be more cross-platform friendly * Re-added cheer graffiti * Cleaning up the inner-loop build-debug-process * Addressed logger and memory leak issues #73 #114 * Added a default configuration builder #34 Addressed logger and memory leak issues #73 #114 (#117) * Refactored to an Proxy interface to address #47 * Added remaining EventsSent to ConfigurationManager * Attempting to eliminate memory leak * Adding script to test the Plugin template * WIP * Updated to be more cross-platform friendly * Re-added cheer graffiti * Cleaning up the inner-loop build-debug-process * Addressed logger and memory leak issues #73 #114 * Fixed some tests, added UUID constructor for #119 * Added a 'RegisterAllActions' feature to the ConnectionManager * Fixed configuration to use the current executing assembly (#127) * Refactored to an Proxy interface to address #47 * Added remaining EventsSent to ConfigurationManager * Attempting to eliminate memory leak * Adding script to test the Plugin template * WIP * Updated to be more cross-platform friendly * Re-added cheer graffiti * Cleaning up the inner-loop build-debug-process * Addressed logger and memory leak issues #73 #114 * Added a default configuration builder #34 Addressed logger and memory leak issues #73 #114 (#117) * Refactored to an Proxy interface to address #47 * Added remaining EventsSent to ConfigurationManager * Attempting to eliminate memory leak * Adding script to test the Plugin template * WIP * Updated to be more cross-platform friendly * Re-added cheer graffiti * Cleaning up the inner-loop build-debug-process * Addressed logger and memory leak issues #73 #114 * Fixed some tests, added UUID constructor for #119 * Added a 'RegisterAllActions' feature to the ConnectionManager * Updated to properly configure current folder * Configuring IsTestProject (#129) --- src/StreamDeckLib.Test/StreamDeckLib.Test.csproj | 1 + 1 file changed, 1 insertion(+) diff --git a/src/StreamDeckLib.Test/StreamDeckLib.Test.csproj b/src/StreamDeckLib.Test/StreamDeckLib.Test.csproj index aa207c9..5b62745 100644 --- a/src/StreamDeckLib.Test/StreamDeckLib.Test.csproj +++ b/src/StreamDeckLib.Test/StreamDeckLib.Test.csproj @@ -4,6 +4,7 @@ netcoreapp2.1 latest false + true From f02a3b5266ed3893dcebaa30e5050a6b59093830 Mon Sep 17 00:00:00 2001 From: BenjaminAbt Date: Wed, 7 Apr 2021 14:03:35 +0200 Subject: [PATCH 3/6] add png image support --- src/StreamDeckLib/ConnectionManager.cs | 30 ++++++++++++++++++++++++++ src/StreamDeckLib/StreamDeckLib.csproj | 1 + 2 files changed, 31 insertions(+) diff --git a/src/StreamDeckLib/ConnectionManager.cs b/src/StreamDeckLib/ConnectionManager.cs index 587fd61..0cbecbb 100644 --- a/src/StreamDeckLib/ConnectionManager.cs +++ b/src/StreamDeckLib/ConnectionManager.cs @@ -8,6 +8,9 @@ using System; using System.Diagnostics; using System.IO; +using System.Drawing; +using System.Drawing.Imaging; +using System.Linq; using System.Net.WebSockets; using System.Threading; using System.Threading.Tasks; @@ -260,6 +263,33 @@ public async Task SetImageAsync(string context, string imageLocation) await _proxy.SendStreamDeckEvent(args); } + public async Task SetPngImageAsync(string context, Bitmap image) + { + Debug.WriteLine("Getting Image from Bitmap"); + _logger?.LogDebug("Getting Image from Bitmap"); + + byte[] imgBytes; + using (var imgByteStream = new MemoryStream()) + { + image.Save(imgByteStream, ImageFormat.Png);// force use png + imgBytes = imgByteStream.ToArray(); + } + var imgString = Convert.ToBase64String(imgBytes, Base64FormattingOptions.None); + + var args = new SetImageArgs + { + context = context, + payload = new SetImageArgs.Payload + { + TargetType = SetTitleArgs.TargetType.HardwareAndSoftware, + image = $"data:image/png;base64, {imgString}" + } + }; + + await _proxy.SendStreamDeckEvent(args); + } + + public async Task ShowAlertAsync(string context) { var args = new ShowAlertArgs() diff --git a/src/StreamDeckLib/StreamDeckLib.csproj b/src/StreamDeckLib/StreamDeckLib.csproj index f04a91d..02b45ec 100644 --- a/src/StreamDeckLib/StreamDeckLib.csproj +++ b/src/StreamDeckLib/StreamDeckLib.csproj @@ -21,6 +21,7 @@ + From 09fde78109ba405be6b971d3f5d8ade9e4c91e51 Mon Sep 17 00:00:00 2001 From: BenjaminAbt Date: Wed, 7 Apr 2021 14:19:45 +0200 Subject: [PATCH 4/6] remove unused using --- src/StreamDeckLib/ConnectionManager.cs | 1 - 1 file changed, 1 deletion(-) diff --git a/src/StreamDeckLib/ConnectionManager.cs b/src/StreamDeckLib/ConnectionManager.cs index 0cbecbb..12b5a2d 100644 --- a/src/StreamDeckLib/ConnectionManager.cs +++ b/src/StreamDeckLib/ConnectionManager.cs @@ -10,7 +10,6 @@ using System.IO; using System.Drawing; using System.Drawing.Imaging; -using System.Linq; using System.Net.WebSockets; using System.Threading; using System.Threading.Tasks; From a984d76a06a5cfc6a3ff2627c2768ba6504bf96e Mon Sep 17 00:00:00 2001 From: Benjamin Abt Date: Fri, 11 Jun 2021 16:10:30 +0200 Subject: [PATCH 5/6] add image data method --- src/StreamDeckLib/ConnectionManager.cs | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/src/StreamDeckLib/ConnectionManager.cs b/src/StreamDeckLib/ConnectionManager.cs index 12b5a2d..be3fee9 100644 --- a/src/StreamDeckLib/ConnectionManager.cs +++ b/src/StreamDeckLib/ConnectionManager.cs @@ -270,25 +270,33 @@ public async Task SetPngImageAsync(string context, Bitmap image) byte[] imgBytes; using (var imgByteStream = new MemoryStream()) { - image.Save(imgByteStream, ImageFormat.Png);// force use png + image.Save(imgByteStream, ImageFormat.Png); imgBytes = imgByteStream.ToArray(); } + var imgString = Convert.ToBase64String(imgBytes, Base64FormattingOptions.None); + await SetImageDataAsync(context, $"data:image/png;base64, {imgString}"); + } + + public async Task SetImageDataAsync(string context, string imageData) + { + Debug.WriteLine("Getting Image from Base64"); + _logger?.LogDebug("Getting Image from Base64"); + var args = new SetImageArgs { context = context, payload = new SetImageArgs.Payload { TargetType = SetTitleArgs.TargetType.HardwareAndSoftware, - image = $"data:image/png;base64, {imgString}" + image = imageData } }; await _proxy.SendStreamDeckEvent(args); } - public async Task ShowAlertAsync(string context) { var args = new ShowAlertArgs() From 66ebfb48a3df887e14f8ddb630cd0f2e4f1cbd33 Mon Sep 17 00:00:00 2001 From: Benjamin Abt Date: Fri, 11 Jun 2021 16:10:49 +0200 Subject: [PATCH 6/6] fix info name --- src/StreamDeckLib/ConnectionManager.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/StreamDeckLib/ConnectionManager.cs b/src/StreamDeckLib/ConnectionManager.cs index be3fee9..80a686a 100644 --- a/src/StreamDeckLib/ConnectionManager.cs +++ b/src/StreamDeckLib/ConnectionManager.cs @@ -281,8 +281,8 @@ public async Task SetPngImageAsync(string context, Bitmap image) public async Task SetImageDataAsync(string context, string imageData) { - Debug.WriteLine("Getting Image from Base64"); - _logger?.LogDebug("Getting Image from Base64"); + Debug.WriteLine("Getting Image from image data"); + _logger?.LogDebug("Getting Image from image data"); var args = new SetImageArgs {