~ruther/NosSmooth

926a69a06a302775591107142f3b1a6cff7fe4b5 — Rutherther 2 years ago 6de4f21
fix(game): do not add game responder multiple times
1 files changed, 5 insertions(+), 0 deletions(-)

M Core/NosSmooth.Game/Extensions/ServiceCollectionExtensions.cs
M Core/NosSmooth.Game/Extensions/ServiceCollectionExtensions.cs => Core/NosSmooth.Game/Extensions/ServiceCollectionExtensions.cs +5 -0
@@ 148,6 148,11 @@ public static class ServiceCollectionExtensions
    /// <returns>The collection.</returns>
    public static IServiceCollection AddGameResponder(this IServiceCollection serviceCollection, Type gameResponder)
    {
        if (serviceCollection.Any(x => x.ImplementationType == gameResponder))
        { // already added... assuming every packet responder was added even though that may not be the case.
            return serviceCollection;
        }

        if (!gameResponder.GetInterfaces().Any
            (
                i => i.IsGenericType && i.GetGenericTypeDefinition() == typeof(IGameResponder<>)

Do not follow this link