46 lines
1.7 KiB
C#
46 lines
1.7 KiB
C#
using MoonlightServers.Daemon.ServerSystem.Abstractions;
|
|
using MoonlightServers.Daemon.Services;
|
|
|
|
namespace MoonlightServers.Daemon.ServerSystem;
|
|
|
|
public class ServerFactory
|
|
{
|
|
private readonly IRuntimeEnvironmentService RuntimeEnvironmentService;
|
|
private readonly IInstallEnvironmentService InstallEnvironmentService;
|
|
private readonly IRuntimeStorageService RuntimeStorageService;
|
|
private readonly IInstallStorageService InstallStorageService;
|
|
private readonly ServerConfigurationService ConfigurationService;
|
|
private readonly ILoggerFactory LoggerFactory;
|
|
|
|
public ServerFactory(
|
|
IRuntimeEnvironmentService runtimeEnvironmentService,
|
|
IInstallEnvironmentService installEnvironmentService,
|
|
IRuntimeStorageService runtimeStorageService,
|
|
IInstallStorageService installStorageService,
|
|
ServerConfigurationService configurationService,
|
|
ILoggerFactory loggerFactory
|
|
)
|
|
{
|
|
RuntimeEnvironmentService = runtimeEnvironmentService;
|
|
InstallEnvironmentService = installEnvironmentService;
|
|
RuntimeStorageService = runtimeStorageService;
|
|
InstallStorageService = installStorageService;
|
|
ConfigurationService = configurationService;
|
|
LoggerFactory = loggerFactory;
|
|
}
|
|
|
|
public async Task<Server> CreateAsync(string uuid)
|
|
{
|
|
var logger = LoggerFactory.CreateLogger($"MoonlightServers.Daemon.ServerSystem.Server({uuid})");
|
|
|
|
return new Server(
|
|
uuid,
|
|
RuntimeEnvironmentService,
|
|
InstallEnvironmentService,
|
|
RuntimeStorageService,
|
|
InstallStorageService,
|
|
ConfigurationService,
|
|
logger
|
|
);
|
|
}
|
|
} |