using Dalamud.Plugin.Services; using JetBrains.Annotations; using Microsoft.Extensions.DependencyInjection; using Questionable.Controller.Steps; namespace Questionable; internal static class ServiceCollectionExtensions { public static void AddTaskFactory< [MeansImplicitUse(ImplicitUseKindFlags.InstantiatedNoFixedConstructorSignature)] TFactory>( this IServiceCollection serviceCollection) where TFactory : class, ITaskFactory { serviceCollection.AddSingleton(); serviceCollection.AddSingleton(); } public static void AddTaskExecutor( this IServiceCollection serviceCollection) where T : class, ITask where TExecutor : TaskExecutor { serviceCollection.AddKeyedTransient(typeof(T)); serviceCollection.AddTransient(); } public static void AddTaskFactoryAndExecutor( this IServiceCollection serviceCollection) where TFactory : class, ITaskFactory where T : class, ITask where TExecutor : TaskExecutor { serviceCollection.AddTaskFactory(); serviceCollection.AddTaskExecutor(); } }