mirror of
https://github.com/wabbajack-tools/wabbajack.git
synced 2024-08-30 18:42:17 +00:00
31 lines
730 B
C#
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;
|
|
});
|
|
}
|
|
} |