2024-09-05 09:48:08 +00:00
|
|
|
using Common;
|
2024-07-30 07:36:42 +00:00
|
|
|
namespace LocalServer;
|
|
|
|
|
|
|
|
public class LocalSyncServerFactory
|
|
|
|
{
|
2024-07-31 09:14:07 +00:00
|
|
|
private readonly object Lock = new();
|
|
|
|
|
2024-09-07 06:46:08 +00:00
|
|
|
public void CreateLocalSyncServer(AbsPipeLine pipeLine,string name)
|
2024-07-30 07:36:42 +00:00
|
|
|
{
|
2024-09-07 06:46:08 +00:00
|
|
|
var server = new LocalSyncServer(pipeLine, this,name);
|
2024-07-31 09:14:07 +00:00
|
|
|
lock (Lock)
|
|
|
|
{
|
|
|
|
Servers.Add(server);
|
|
|
|
}
|
2024-07-30 07:36:42 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
private readonly List<LocalSyncServer> Servers = [];
|
|
|
|
|
|
|
|
public void RemoveLocalSyncServer(LocalSyncServer server)
|
|
|
|
{
|
2024-07-31 09:14:07 +00:00
|
|
|
lock (Lock)
|
|
|
|
{
|
|
|
|
Servers.Remove(server);
|
|
|
|
}
|
2024-07-30 07:36:42 +00:00
|
|
|
}
|
2024-09-07 06:46:08 +00:00
|
|
|
|
|
|
|
public LocalSyncServer? GetServerByName(string name)
|
|
|
|
{
|
|
|
|
var it = Servers.Where(x=>x.Name== name).FirstOrDefault();
|
|
|
|
return it;
|
|
|
|
}
|
2024-07-30 07:36:42 +00:00
|
|
|
}
|