46 lines
1.6 KiB
C#
46 lines
1.6 KiB
C#
/* This software is licensed by the MIT License, see LICENSE file */
|
|
/* Copyright © 2024-2025 Gregory Lirent */
|
|
|
|
#if WINIPC_UA_SERVER
|
|
using System.Runtime.Versioning;
|
|
using WinIPC.Config;
|
|
using WinIPC.Services;
|
|
using WinIPC.Utils;
|
|
|
|
[assembly: SupportedOSPlatform("windows")]
|
|
|
|
namespace UserSessionAgent
|
|
{
|
|
public class Program
|
|
{
|
|
public static async Task Main(string[] args)
|
|
{
|
|
var hostBuilder = CreateHostBuilder(args);
|
|
var host = hostBuilder.Build();
|
|
await host.RunAsync();
|
|
}
|
|
|
|
public static IHostBuilder CreateHostBuilder(string[] args) =>
|
|
Host.CreateDefaultBuilder(args)
|
|
.ConfigureLogging(logging =>
|
|
{
|
|
logging.ClearProviders();
|
|
logging.AddConsole();
|
|
logging.AddDebug();
|
|
})
|
|
.ConfigureServices((hostContext, services) =>
|
|
{
|
|
services.AddOptions();
|
|
services.Configure<AppConfig>(hostContext.Configuration.GetSection("AppConfig"));
|
|
|
|
services.AddSingleton<WindowScanner>();
|
|
services.AddSingleton<InputHandler>();
|
|
services.AddSingleton<IPCServerService>();
|
|
services.AddSingleton<UserAgentService>();
|
|
|
|
services.AddHostedService(sp => sp.GetRequiredService<IPCServerService>());
|
|
services.AddHostedService(sp => sp.GetRequiredService<UserAgentService>());
|
|
});
|
|
}
|
|
}
|
|
#endif |