Beispiel #1
0
        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);
        }
Beispiel #2
0
        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);
        }
Beispiel #3
0
 public FtpHelper(FtpConfig config)
 {
     this.FtpRootPath = config.RootPath;
     this.Client      = CreateClient(config);
 }