private FtpClient CreateClient(FtpConfig config) { FtpClient client = new FtpClient(config.Host, config.Port, config.User, config.Password); client.ConnectTimeout = 30000; //https://github.com/robinrodricks/FluentFTP#trouble_closedhost client.SocketPollInterval = 1000; return(client); }
public static FtpConfig FromConfiguration() { FtpConfig config = new FtpConfig(); config.RootPath = ConfigurationManager.AppSettings["FTPRootPath"]; config.Host = ConfigurationManager.AppSettings["FTPHost"]; config.Port = int.Parse(ConfigurationManager.AppSettings["FTPPort"]); config.User = ConfigurationManager.AppSettings["FTPUser"]; config.Password = ConfigurationManager.AppSettings["FTPPwd"]; return(config); }
public FtpHelper(FtpConfig config) { this.FtpRootPath = config.RootPath; this.Client = CreateClient(config); }