2020-11-11 18:31:26 -05:00
|
|
|
|
using System;
|
2021-03-22 12:09:25 -04:00
|
|
|
|
using Data.Abstractions;
|
|
|
|
|
using Data.Models.Server;
|
2020-11-17 19:24:54 -05:00
|
|
|
|
using Microsoft.Extensions.DependencyInjection;
|
2020-11-11 18:31:26 -05:00
|
|
|
|
using SharedLibraryCore;
|
2020-02-11 17:44:06 -05:00
|
|
|
|
using SharedLibraryCore.Configuration;
|
|
|
|
|
using SharedLibraryCore.Interfaces;
|
|
|
|
|
|
|
|
|
|
namespace IW4MAdmin.Application.Factories
|
|
|
|
|
{
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// implementation of IGameServerInstanceFactory
|
|
|
|
|
/// </summary>
|
|
|
|
|
internal class GameServerInstanceFactory : IGameServerInstanceFactory
|
|
|
|
|
{
|
|
|
|
|
private readonly ITranslationLookup _translationLookup;
|
2022-03-23 09:43:57 -04:00
|
|
|
|
private readonly IMetaServiceV2 _metaService;
|
2020-11-11 18:31:26 -05:00
|
|
|
|
private readonly IServiceProvider _serviceProvider;
|
2020-02-11 17:44:06 -05:00
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// base constructor
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="translationLookup"></param>
|
|
|
|
|
/// <param name="rconConnectionFactory"></param>
|
2021-06-30 19:10:45 -04:00
|
|
|
|
public GameServerInstanceFactory(ITranslationLookup translationLookup,
|
2022-03-23 09:43:57 -04:00
|
|
|
|
IMetaServiceV2 metaService,
|
2020-11-11 18:31:26 -05:00
|
|
|
|
IServiceProvider serviceProvider)
|
2020-02-11 17:44:06 -05:00
|
|
|
|
{
|
|
|
|
|
_translationLookup = translationLookup;
|
2020-08-17 22:21:11 -04:00
|
|
|
|
_metaService = metaService;
|
2020-11-11 18:31:26 -05:00
|
|
|
|
_serviceProvider = serviceProvider;
|
2020-02-11 17:44:06 -05:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// creates an IW4MServer instance
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="config">server configuration</param>
|
|
|
|
|
/// <param name="manager">application manager</param>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
public Server CreateServer(ServerConfiguration config, IManager manager)
|
|
|
|
|
{
|
2021-06-30 19:10:45 -04:00
|
|
|
|
return new IW4MServer(config,
|
|
|
|
|
_serviceProvider.GetRequiredService<CommandConfiguration>(), _translationLookup, _metaService,
|
|
|
|
|
_serviceProvider, _serviceProvider.GetRequiredService<IClientNoticeMessageFormatter>(),
|
|
|
|
|
_serviceProvider.GetRequiredService<ILookupCache<EFServer>>());
|
2020-02-11 17:44:06 -05:00
|
|
|
|
}
|
|
|
|
|
}
|
2022-03-23 09:43:57 -04:00
|
|
|
|
}
|