blob: ad1fdc778e95cef00a3910599008ecd1ed3f4900 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
|
using System;
using Impostor.Api.Net;
using Microsoft.Extensions.DependencyInjection;
namespace Impostor.Server.Net.Factories
{
internal class ClientFactory<TClient> : IClientFactory
where TClient : ClientBase
{
private readonly IServiceProvider _serviceProvider;
public ClientFactory(IServiceProvider serviceProvider)
{
_serviceProvider = serviceProvider;
}
public ClientBase Create(IHazelConnection connection, string name, int clientVersion)
{
var client = ActivatorUtilities.CreateInstance<TClient>(_serviceProvider, name, connection);
connection.Client = client;
return client;
}
}
}
|