Exemple #1
0
 private void Form1_Load(object sender, EventArgs e)
 {
     Task.Run(() =>
     {
         this.Invoke(new delegate_update(update_txt), $"初始化系统数据");
         System.Threading.Thread.Sleep(2000);
         FTP.FtpConfig ftpConfig = new Ftp.FtpConfig()
         {
             str_FtpUri      = "172.18.84.23",
             int_FtpPort     = 21,
             str_FtpUserID   = "admin",
             str_FtpPassword = "******",
             int_RetryTimes  = 3
         };
         for (int i = 0; i < limit_count; i++)
         {
             ftp_client_list.Add(new Ftp.FtpHelper(ftpConfig));
         }
         //ftpHelper = new Ftp.FtpHelper(ftpConfig);
         is_load = true;
         this.Invoke(new delegate_update(update_txt), $"初始化系统数据成功");
     });
     this.timer1.Start();
     this.timer2.Start();
 }
Exemple #2
0
 /// <summary>
 /// 构造函数
 /// </summary>
 /// <param name="ftpConfig">FTP配置封装</param>
 public FtpHelper(FtpConfig ftpConfig)
 {
     this.strFtpUri      = ftpConfig.str_FtpUri;
     this.intFtpPort     = ftpConfig.int_FtpPort;
     this.strFtpUserID   = ftpConfig.str_FtpUserID;
     this.strFtpPassword = ftpConfig.str_FtpPassword;
     this.intRetryTimes  = ftpConfig.int_RetryTimes;
     //创建ftp客户端
     GetFtpClient();
 }
Exemple #3
0
 /// <summary>
 /// 初始化ftp信息
 /// </summary>
 /// <param name="server"></param>
 private void initFtp(Entity.Pe_serverinfo server)
 {
     FTP.FtpConfig ftpConfig = new Ftp.FtpConfig()
     {
         str_FtpUri      = server.Serverip,
         int_FtpPort     = (int)server.Port,
         str_FtpUserID   = server.Ftpusername,
         str_FtpPassword = server.Pwd,
         int_RetryTimes  = 3
     };
     ftp_server_mainpath = server.Path.ToLower().Replace($"http://{server.Serverip}/", "");
     if (ftp_server_mainpath.EndsWith("/"))
     {
         ftp_server_mainpath = ftp_server_mainpath.Substring(0, ftp_server_mainpath.Length - 1);
     }
     for (int i = 0; i < limit_upload_count; i++)
     {
         ftp_client_list.Add(new Ftp.FtpHelper(ftpConfig));
     }
 }