LANCommander/LANCommander.SDK/Extensions/IServiceCollectionExtensions.cs
Pat Hartl f87756243e Add support for defining PowerShell modules
Adds a new section "Scripting" in the server UI where PowerShell modules can be defined. These can be used for defining a library of functions that can be used in any script. These modules are automatically synced to the launcher and imported upon script execution.
2026-06-28 23:02:35 -05:00

68 lines
No EOL
2.9 KiB
C#

using LANCommander.SDK.Abstractions;
using LANCommander.SDK.Clients;
using LANCommander.SDK.Factories;
using LANCommander.SDK.Models;
using LANCommander.SDK.PowerShell;
using LANCommander.SDK.Providers;
using LANCommander.SDK.Rpc.Client;
using LANCommander.SDK.Services;
using LANCommander.Steam.Abstractions;
using LANCommander.Steam.Extensions;
using LANCommander.Steam.Services;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.DependencyInjection.Extensions;
using RpcSubscriber = LANCommander.SDK.Rpc.Clients.RpcSubscriber;
namespace LANCommander.SDK.Extensions;
public static class IServiceCollectionExtensions
{
public static IServiceCollection AddLANCommanderClient<TSettings>(this IServiceCollection services) where TSettings : Settings, new()
{
services.AddSingleton<SettingsProvider<TSettings>>();
services.AddSingleton<ISettingsProvider>(sp =>
sp.GetRequiredService<SettingsProvider<TSettings>>());
services.AddSingleton<Microsoft.Extensions.Hosting.IHostedService>(sp =>
sp.GetRequiredService<SettingsProvider<TSettings>>());
services.TryAddSingleton<ITokenProvider, TokenProvider>();
services.TryAddSingleton<INetworkInformationProvider, NetworkInformationProvider>();
services.TryAddSingleton<IServerAddressProvider, ServerAddressProvider>();
services.AddSingleton<IRpcSubscriber, RpcSubscriber>();
services.AddSingleton<RpcClient>();
services.AddSingleton<ApiRequestFactory>();
services.AddSingleton<ProcessExecutionContextFactory>();
services.AddSingleton<PowerShellScriptFactory>();
services.AddSingleton<AuthenticationClient>();
services.AddSingleton<BeaconClient>();
services.AddSingleton<ChatHubClient>();
services.AddSingleton<IConnectionClient, ConnectionClient>();
services.AddSingleton<DepotClient>();
services.AddSingleton<DiscordClient>();
services.AddSingleton<GameClient>();
services.AddSingleton<IssueClient>();
services.AddSingleton<LauncherClient>();
services.AddSingleton<LibraryClient>();
services.AddSingleton<LobbyClient>();
services.AddSingleton<MediaClient>();
services.AddSingleton<ModuleClient>();
services.AddSingleton<PlaySessionClient>();
services.AddSingleton<ProfileClient>();
services.AddSingleton<RedistributableClient>();
services.AddSingleton<SaveClient>();
services.AddSingleton<ScriptClient>();
services.AddSingleton<ServerClient>();
services.AddSingleton<TagClient>();
services.AddSingleton<ToolClient>();
services.AddSingleton<MetadataClient>();
services.AddSingleton<MigrationHistoryService>();
services.AddSingleton<MigrationService>();
services.TryAddSingleton<IChatClient, ChatClient>();
return services;
}
}