From 697e116ee64d2bc5e706e32db5c67ebc9ce0fb5f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ayta=C3=A7=20Kayadelen?= Date: Fri, 29 Dec 2023 16:17:51 +0100 Subject: [PATCH] fix numbering in logitech pipe name --- .../Services/LogitechPipeListenerService.cs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/Logitech/Artemis.Plugins.Wrappers.Logitech/Services/LogitechPipeListenerService.cs b/src/Logitech/Artemis.Plugins.Wrappers.Logitech/Services/LogitechPipeListenerService.cs index d4c50c3..1db5a2d 100644 --- a/src/Logitech/Artemis.Plugins.Wrappers.Logitech/Services/LogitechPipeListenerService.cs +++ b/src/Logitech/Artemis.Plugins.Wrappers.Logitech/Services/LogitechPipeListenerService.cs @@ -38,13 +38,18 @@ public LogitechPipeListenerService(ILogger logger, Plugin plugin) _colors = new(); _excluded = new(); - _pipeListener = new("LGS_LED_SDK-00000001"); + var id = WTSGetActiveConsoleSessionId(); + var pipeName = $"LGS_LED_SDK-{id:00000000}"; + _pipeListener = new(pipeName); _pipeListener.ClientConnected += OnPipeListenerClientConnected; _pipeListener.ClientDisconnected += OnPipeListenerClientDisconnected; _pipeListener.CommandReceived += OnPipeListenerCommandReceived; _pipeListener.Exception += OnPipeListenerException; } + [DllImport("kernel32.dll")] + private static extern uint WTSGetActiveConsoleSessionId(); + private void OnPipeListenerException(object sender, Exception e) { _logger.Error(e, "Logitech wrapper reader exception ");