2020-11-11 18:31:26 -05:00
|
|
|
|
using System;
|
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;
|
2020-08-17 22:21:11 -04:00
|
|
|
|
private readonly IMetaService _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>
|
2020-11-11 18:31:26 -05:00
|
|
|
|
public GameServerInstanceFactory(ITranslationLookup translationLookup,
|
|
|
|
|
IMetaService metaService,
|
|
|
|
|
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)
|
|
|
|
|
{
|
2020-11-17 19:24:54 -05:00
|
|
|
|
return new IW4MServer(config, _translationLookup, _metaService, _serviceProvider, _serviceProvider.GetRequiredService<IClientNoticeMessageFormatter>());
|
2020-02-11 17:44:06 -05:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|