From 293e91806178140666a8970f21aa3c03de06238c Mon Sep 17 00:00:00 2001 From: DataNext Date: Tue, 26 Mar 2024 21:35:41 +0100 Subject: [PATCH] Rare crash fix --- TPSteelSeriesGG.csproj | 4 ++-- TPSteelSeriesGG.sln.DotSettings.user | 4 ++++ src/SteelSeriesAPI/SteelSeriesHTTPHandler.cs | 11 ++++++++--- 3 files changed, 14 insertions(+), 5 deletions(-) create mode 100644 TPSteelSeriesGG.sln.DotSettings.user diff --git a/TPSteelSeriesGG.csproj b/TPSteelSeriesGG.csproj index 3aaaac0..bc5876f 100644 --- a/TPSteelSeriesGG.csproj +++ b/TPSteelSeriesGG.csproj @@ -8,9 +8,9 @@ - + - + diff --git a/TPSteelSeriesGG.sln.DotSettings.user b/TPSteelSeriesGG.sln.DotSettings.user new file mode 100644 index 0000000..d1fdef6 --- /dev/null +++ b/TPSteelSeriesGG.sln.DotSettings.user @@ -0,0 +1,4 @@ + + <AssemblyExplorer> + <Assembly Path="C:\Users\Aurel\.nuget\packages\packetdotnet\1.4.8-pre18\lib\net7.0\PacketDotNet.dll" /> +</AssemblyExplorer> \ No newline at end of file diff --git a/src/SteelSeriesAPI/SteelSeriesHTTPHandler.cs b/src/SteelSeriesAPI/SteelSeriesHTTPHandler.cs index f5e0f66..414f726 100644 --- a/src/SteelSeriesAPI/SteelSeriesHTTPHandler.cs +++ b/src/SteelSeriesAPI/SteelSeriesHTTPHandler.cs @@ -107,10 +107,15 @@ public static void StartSteelSeriesListener() // Ouvrir l'interface de bouclage pour la capture loopbackDevice.OnPacketArrival += (object s, PacketCapture e) => { - var rawPacket = e.GetPacket(); - if (rawPacket.Data.Length <= 0) + RawCapture rawPacket; + try { - return; + rawPacket = e.GetPacket(); + } + catch (ArgumentException exception) + { + Console.WriteLine(exception); + throw; } Packet packet = Packet.ParsePacket(rawPacket.LinkLayerType, rawPacket.Data);