using System;
using Data.Abstractions;
using Data.Models.Server;
using Microsoft.Extensions.DependencyInjection;
using SharedLibraryCore;
using SharedLibraryCore.Configuration;
using SharedLibraryCore.Interfaces;
namespace IW4MAdmin.Application.Factories
{
///
/// implementation of IGameServerInstanceFactory
///
internal class GameServerInstanceFactory : IGameServerInstanceFactory
{
private readonly ITranslationLookup _translationLookup;
private readonly IMetaService _metaService;
private readonly IServiceProvider _serviceProvider;
///
/// base constructor
///
///
///
public GameServerInstanceFactory(ITranslationLookup translationLookup,
IMetaService metaService,
IServiceProvider serviceProvider)
{
_translationLookup = translationLookup;
_metaService = metaService;
_serviceProvider = serviceProvider;
}
///
/// creates an IW4MServer instance
///
/// server configuration
/// application manager
///
public Server CreateServer(ServerConfiguration config, IManager manager)
{
return new IW4MServer(config,
_serviceProvider.GetRequiredService(), _translationLookup, _metaService,
_serviceProvider, _serviceProvider.GetRequiredService(),
_serviceProvider.GetRequiredService>());
}
}
}