From 04984d7e3d226ec0c63efb2eb8b354b918bd1011 Mon Sep 17 00:00:00 2001 From: Rutherther Date: Sun, 5 Feb 2023 20:00:11 +0100 Subject: [PATCH] feat(core): add support for raw packet responder from AddPacketResponder --- .../NosSmooth.Core/Extensions/ServiceCollectionExtensions.cs | 5 +++++ Core/NosSmooth.Core/NosSmooth.Core.csproj | 4 ++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/Core/NosSmooth.Core/Extensions/ServiceCollectionExtensions.cs b/Core/NosSmooth.Core/Extensions/ServiceCollectionExtensions.cs index cb0aa2f119f26dc8700753a1d89382de2801954f..02b7a9bf54af6896d4810b4d9b52ae5223360ce5 100644 --- a/Core/NosSmooth.Core/Extensions/ServiceCollectionExtensions.cs +++ b/Core/NosSmooth.Core/Extensions/ServiceCollectionExtensions.cs @@ -116,6 +116,11 @@ public static class ServiceCollectionExtensions return serviceCollection; } + if (responderType.GetInterfaces().Any(i => i == typeof(IRawPacketResponder))) + { + return serviceCollection.AddScoped(typeof(IRawPacketResponder), responderType); + } + if (responderType.GetInterfaces().Any(i => i == typeof(IEveryPacketResponder))) { return serviceCollection.AddScoped(typeof(IEveryPacketResponder), responderType); diff --git a/Core/NosSmooth.Core/NosSmooth.Core.csproj b/Core/NosSmooth.Core/NosSmooth.Core.csproj index c40cf05a794809f4f13a9830a325e8465f33e9e8..0b4c7c9fb8b8a114b183e6bd35c270213ea590f8 100644 --- a/Core/NosSmooth.Core/NosSmooth.Core.csproj +++ b/Core/NosSmooth.Core/NosSmooth.Core.csproj @@ -6,8 +6,8 @@ net7.0;netstandard2.1 Rutherther NosSmooth Core library allowing implementing nostale client, handling packets and commands. - 4.0.0 - Split raw client and managed client. Create PacketHandlers for both raw and managed packets. + 4.0.1 + Support raw packet resopnder inside of AddPacketResponder.