267e0b8cbe
reenable tekno support address vagrant thread issue refactor game log reader creation to follow better practices fix bot issues/address how guids are generated for bots/none provided
34 lines
1.1 KiB
C#
34 lines
1.1 KiB
C#
using IW4MAdmin.Application.IO;
|
|
using Microsoft.Extensions.DependencyInjection;
|
|
using SharedLibraryCore.Interfaces;
|
|
using System;
|
|
|
|
namespace IW4MAdmin.Application.Factories
|
|
{
|
|
public class GameLogReaderFactory : IGameLogReaderFactory
|
|
{
|
|
private readonly IServiceProvider _serviceProvider;
|
|
|
|
public GameLogReaderFactory(IServiceProvider serviceProvider)
|
|
{
|
|
_serviceProvider = serviceProvider;
|
|
}
|
|
|
|
public IGameLogReader CreateGameLogReader(Uri[] logUris, IEventParser eventParser)
|
|
{
|
|
var baseUri = logUris[0];
|
|
if (baseUri.Scheme == Uri.UriSchemeHttp)
|
|
{
|
|
return new GameLogReaderHttp(logUris, eventParser, _serviceProvider.GetRequiredService<ILogger>());
|
|
}
|
|
|
|
else if (baseUri.Scheme == Uri.UriSchemeFile)
|
|
{
|
|
return new GameLogReader(baseUri.LocalPath, eventParser, _serviceProvider.GetRequiredService<ILogger>());
|
|
}
|
|
|
|
throw new NotImplementedException($"No log reader implemented for Uri scheme \"{baseUri.Scheme}\"");
|
|
}
|
|
}
|
|
}
|