You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Zero/ZeroLevel/Services/Network/FileTransfer/FileClientFactory.cs

25 lines
1.1 KiB

6 years ago
using ZeroLevel.Services.FileSystem;
6 years ago
6 years ago
namespace ZeroLevel.Network.FileTransfer
6 years ago
{
public static class FileClientFactory
{
public static IFileClient Create(string serverEndpoint, string baseFolder, ClientFolderNameMapper nameMapper = null)
{
5 years ago
var client = new ExClient(new SocketClient(NetUtils.CreateIPEndPoint(serverEndpoint), new Router()));
return CreateFileServerClient(client, baseFolder,
nameMapper ?? (c => FSUtils.FileNameCorrection($"{c.Endpoint.Address}_{c.Endpoint.Port}")), true);
6 years ago
}
public static IFileClient Create(ExClient client, string baseFolder, ClientFolderNameMapper nameMapper = null)
6 years ago
{
return CreateFileServerClient(client, baseFolder, nameMapper ?? (c => FSUtils.FileNameCorrection($"{c.Endpoint.Address}_{c.Endpoint.Port}")), false);
}
private static IFileClient CreateFileServerClient(ExClient client, string baseFolder, ClientFolderNameMapper nameMapper, bool disposeClient)
6 years ago
{
return new FileClient(client, baseFolder, nameMapper, disposeClient);
}
}
}

Powered by TurnKey Linux.