using System; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Options; using LANCommander.Steam.Abstractions; using LANCommander.Steam.Implementations; using LANCommander.Steam.Options; using LANCommander.Steam.Services; namespace LANCommander.Steam.Extensions; /// /// Extension methods for registering SteamCMD services /// public static class ServiceCollectionExtensions { /// /// Add SteamCMD service with default in-memory profile store /// public static IServiceCollection AddSteamCmd(this IServiceCollection services, Action? configure = null) { if (configure != null) { services.Configure(configure); } else { services.Configure(_ => { }); } services.AddSingleton(); services.AddScoped(); return services; } /// /// Add SteamCMD service with custom profile store implementation /// public static IServiceCollection AddSteamCmd( this IServiceCollection services, Action? configure = null) where TProfileStore : class, ISteamCmdProfileStore { if (configure != null) { services.Configure(configure); } else { services.Configure(_ => { }); } services.AddSingleton(); services.AddScoped(); return services; } /// /// Add SteamCMD service with existing profile store instance /// public static IServiceCollection AddSteamCmd( this IServiceCollection services, ISteamCmdProfileStore profileStore, Action? configure = null) { if (configure != null) { services.Configure(configure); } else { services.Configure(_ => { }); } services.AddSingleton(profileStore); services.AddScoped(); return services; } }