using System.Threading.Tasks;
using IW4MAdmin.Application.Misc;
using SharedLibraryCore.Interfaces;
namespace IW4MAdmin.Application.Factories
{
///
/// implementation of IConfigurationHandlerFactory
/// provides base functionality to create configuration handlers
///
public class ConfigurationHandlerFactory : IConfigurationHandlerFactory
{
///
/// creates a base configuration handler
///
/// base configuration type
/// name of the config file
///
public IConfigurationHandler GetConfigurationHandler(string name) where T : IBaseConfiguration
{
var handler = new BaseConfigurationHandler(name);
handler.BuildAsync().Wait();
return handler;
}
///
public async Task> GetConfigurationHandlerAsync(string name) where T : IBaseConfiguration
{
var handler = new BaseConfigurationHandler(name);
await handler.BuildAsync();
return handler;
}
}
}