blob: c9aa07e4a12601c7ec50cd0872b607b6b5bd67d2 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
|
using PKISharp.WACS.Clients;
using System.Linq;
using System.Threading.Tasks;
namespace PKISharp.WACS.Plugins.ValidationPlugins.Http
{
internal class Ftp : HttpValidation<FtpOptions, Ftp>
{
private readonly FtpClient _ftpClient;
public Ftp(FtpOptions options, HttpValidationParameters pars, RunLevel runLevel) : base(options, runLevel, pars) => _ftpClient = new FtpClient(_options.Credential, pars.LogService);
protected override char PathSeparator => '/';
protected override async Task DeleteFile(string path) => _ftpClient.Delete(path, FtpClient.FileType.File);
protected override async Task DeleteFolder(string path) => _ftpClient.Delete(path, FtpClient.FileType.Directory);
protected override async Task<bool> IsEmpty(string path) => !_ftpClient.GetFiles(path).Any();
protected override async Task WriteFile(string path, string content) => _ftpClient.Upload(path, content);
}
}
|