wabbajack/Wabbajack.Server.Lib/DTOs/FtpSite.cs
2021-10-23 10:51:17 -06:00

31 lines
730 B
C#

using System.Net;
using System.Threading.Tasks;
using FluentFTP;
using Microsoft.Extensions.Logging;
using Wabbajack.Common;
namespace Wabbajack.Server.Lib.DTOs;
public enum StorageSpace
{
AuthoredFiles,
Patches,
Mirrors
}
public class FtpSite
{
public string Username { get; set; }
public string Password { get; set; }
public string Hostname { get; set; }
public async Task<FtpClient> GetClient(ILogger logger)
{
return await CircuitBreaker.WithAutoRetryAllAsync(logger, async () =>
{
var ftpClient = new FtpClient(Hostname, new NetworkCredential(Username, Password));
await ftpClient.ConnectAsync();
return ftpClient;
});
}
}