2025-11-26 01:09:52 -06:00
|
|
|
|
using LANCommander.Launcher.Data;
|
2025-11-29 18:24:27 -06:00
|
|
|
|
using LANCommander.Launcher.Services.Import;
|
|
|
|
|
|
using LANCommander.Launcher.Services.Import.Factories;
|
|
|
|
|
|
using LANCommander.Launcher.Services.Import.Importers;
|
2025-11-26 01:09:52 -06:00
|
|
|
|
using LANCommander.Launcher.Services.PowerShell;
|
2024-08-06 18:24:44 -05:00
|
|
|
|
using Microsoft.EntityFrameworkCore;
|
|
|
|
|
|
using Microsoft.Extensions.DependencyInjection;
|
2024-09-25 20:27:23 -05:00
|
|
|
|
using Microsoft.Extensions.Logging;
|
2025-11-23 20:54:56 -06:00
|
|
|
|
using LANCommander.SDK.PowerShell;
|
2024-08-06 18:24:44 -05:00
|
|
|
|
|
2024-08-07 18:48:13 -05:00
|
|
|
|
namespace LANCommander.Launcher.Services.Extensions
|
2024-08-06 18:24:44 -05:00
|
|
|
|
{
|
2024-09-25 20:27:23 -05:00
|
|
|
|
public class LANCommanderOptions
|
|
|
|
|
|
{
|
2025-12-11 16:18:11 +11:00
|
|
|
|
public ILogger? Logger { get; set; }
|
|
|
|
|
|
public string? ServerAddress { get; set; }
|
2024-09-25 20:27:23 -05:00
|
|
|
|
}
|
|
|
|
|
|
|
2024-08-06 18:24:44 -05:00
|
|
|
|
public static class ServiceCollectionExtensions
|
|
|
|
|
|
{
|
2025-12-12 11:27:13 +11:00
|
|
|
|
public static IServiceCollection AddLANCommanderLauncher(this IServiceCollection services, Action<LANCommanderOptions>? configure = null)
|
2024-08-06 18:24:44 -05:00
|
|
|
|
{
|
2025-11-29 18:24:27 -06:00
|
|
|
|
services.AddDbContext<DbContext, DatabaseContext>(options =>
|
|
|
|
|
|
{
|
|
|
|
|
|
options.EnableSensitiveDataLogging();
|
|
|
|
|
|
});
|
2024-08-06 18:24:44 -05:00
|
|
|
|
|
|
|
|
|
|
#region Register Client
|
2025-12-12 11:27:13 +11:00
|
|
|
|
var options = new LANCommanderOptions();
|
|
|
|
|
|
|
|
|
|
|
|
configure?.Invoke(options);
|
|
|
|
|
|
|
2024-08-06 18:24:44 -05:00
|
|
|
|
services.AddSingleton<MessageBusService>();
|
2025-01-18 20:25:39 -06:00
|
|
|
|
services.AddSingleton<AuthenticationService>();
|
|
|
|
|
|
services.AddSingleton<KeepAliveService>();
|
2024-08-06 18:24:44 -05:00
|
|
|
|
#endregion
|
2025-11-23 20:54:56 -06:00
|
|
|
|
|
2025-11-26 01:09:52 -06:00
|
|
|
|
services.AddSingleton<IScriptInterceptor, ElevatedScriptInterceptor>();
|
|
|
|
|
|
services.AddSingleton<ScriptDebugger>();
|
|
|
|
|
|
services.AddSingleton<IScriptDebugger>(sp =>
|
|
|
|
|
|
sp.GetRequiredService<ScriptDebugger>());
|
2025-01-18 20:25:39 -06:00
|
|
|
|
|
2025-02-06 20:54:03 -06:00
|
|
|
|
services.AddSingleton<ImportManagerService>();
|
2024-08-06 18:24:44 -05:00
|
|
|
|
services.AddScoped<CollectionService>();
|
2024-09-18 19:12:55 -05:00
|
|
|
|
services.AddScoped<CommandLineService>();
|
2024-08-06 18:24:44 -05:00
|
|
|
|
services.AddScoped<CompanyService>();
|
2024-10-26 15:48:47 -05:00
|
|
|
|
services.AddScoped<InstallService>();
|
2024-08-06 18:24:44 -05:00
|
|
|
|
services.AddScoped<EngineService>();
|
|
|
|
|
|
services.AddScoped<GameService>();
|
|
|
|
|
|
services.AddScoped<GenreService>();
|
2024-09-18 19:12:55 -05:00
|
|
|
|
services.AddScoped<ImportService>();
|
|
|
|
|
|
services.AddScoped<LibraryService>();
|
2025-01-19 00:06:44 -06:00
|
|
|
|
services.AddScoped<UserService>();
|
2024-11-12 02:35:28 -06:00
|
|
|
|
services.AddScoped<DepotService>();
|
2024-08-06 18:24:44 -05:00
|
|
|
|
services.AddScoped<MediaService>();
|
2024-09-18 19:12:55 -05:00
|
|
|
|
services.AddScoped<MultiplayerModeService>();
|
|
|
|
|
|
services.AddScoped<PlatformService>();
|
2024-08-06 18:24:44 -05:00
|
|
|
|
services.AddScoped<PlaySessionService>();
|
2024-09-18 19:12:55 -05:00
|
|
|
|
services.AddScoped<ProfileService>();
|
2024-08-06 18:24:44 -05:00
|
|
|
|
services.AddScoped<RedistributableService>();
|
|
|
|
|
|
services.AddScoped<SaveService>();
|
2024-09-18 19:12:55 -05:00
|
|
|
|
services.AddScoped<TagService>();
|
2024-08-06 18:24:44 -05:00
|
|
|
|
services.AddScoped<UpdateService>();
|
2025-11-29 18:24:27 -06:00
|
|
|
|
|
|
|
|
|
|
#region Import
|
|
|
|
|
|
|
|
|
|
|
|
services.AddScoped<ImportContextFactory>();
|
|
|
|
|
|
|
|
|
|
|
|
services.AddScoped<CollectionImporter>();
|
|
|
|
|
|
services.AddScoped<DeveloperImporter>();
|
|
|
|
|
|
services.AddScoped<EngineImporter>();
|
|
|
|
|
|
services.AddScoped<GameImporter>();
|
|
|
|
|
|
services.AddScoped<GenreImporter>();
|
|
|
|
|
|
services.AddScoped<MultiplayerModeImporter>();
|
|
|
|
|
|
services.AddScoped<PlatformImporter>();
|
|
|
|
|
|
services.AddScoped<PublisherImporter>();
|
|
|
|
|
|
services.AddScoped<TagImporter>();
|
2025-12-19 10:35:50 +11:00
|
|
|
|
services.AddScoped<MediaImporter>();
|
2025-11-29 18:24:27 -06:00
|
|
|
|
#endregion
|
2024-08-06 18:24:44 -05:00
|
|
|
|
|
|
|
|
|
|
return services;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|