public CAbstractFtpManager(CFtpServerInfo ftpInfo, bool enable_ssh = true)
        {
            this.m_ftpInfo = ftpInfo;
            this.m_enable_ssh = enable_ssh;

            try
            {
                WebRequest.Create(ftpInfo.getFullUrl());
            }
            catch (System.Exception ex)
            {
                throw ex;
            }
        }
示例#2
0
        /// <summary>
        /// 用来测试的函数,界面一点,执行某个功能,只是用来测一测
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void click_to_test(object sender, RoutedEventArgs e)
        {
            CExternalFtpManage ftpManager = null;
            try
            {
                CFtpServerInfo ftpInfo = new CFtpServerInfo("ftp://10.60.0.122/server.xml");
                ftpInfo = new CFtpServerInfo("ftp://10.60.0.122/各种软件/TortoiseSVN-1.6.14.21012-win32-svn-1.6.16.msi");
                ftpManager = new CExternalFtpManage(ftpInfo, false);
                ftpManager = new CExternalFtpManage(new CFtpServerInfo("ftp://10.60.0.122/"), false);

                ftpManager.onDownloadStarted += new CExternalFtpManage.FtpHandler(onDownloadStarted);
                ftpManager.onDownloadAdvanced += new CExternalFtpManage.FtpHandler(onDownloadAdvanced);
                ftpManager.onDownloadFinished += new CExternalFtpManage.FtpHandler(onDownloadFinished);

                ftpManager.onFileSizeRetrieved += new CExternalFtpManage.FtpHandler(onFileSizeRetrieved);

                ftpManager.onUploadStarted += new CExternalFtpManage.FtpHandler(onUploadStarted);
                ftpManager.onUploadAdvanced += new CExternalFtpManage.FtpHandler(onUploadAdvanced);
                ftpManager.onUploadFinished += new CExternalFtpManage.FtpHandler(onUploadFinished);
            }
            catch (System.Exception ex)
            {
                MessageBox.Show(ex.ToString());
                return;
            }

            try
            {
                //ftpManager.startDownloading("C:\\Users\\Andriy\\Desktop", true);

                ftpManager.startUploading("C:\\Users\\Andriy\\Desktop\\Advanced_Programming_in_The_Unix_Environment(2nd).chm", "Advanced_Programming_in_The_Unix_Environment(2nd).chm");
                //ftpManager.renameFile("Advanced_Programming_in_The_Unix_Environment(2nd).chm", "Unix高级环境编程.chm");
                //ftpManager.delete("Advanced_Programming_in_The_Unix_Environment(2nd).chm");
            //                 string[] details = ftpManager.getFileDetailList();
            //                 StringBuilder builder = new StringBuilder();
            //                 foreach (string s in details)
            //                 {
            //                     builder.Append(s + "  |  ");
            //                 }
            //                 MessageBox.Show(builder.ToString());
            }
            catch (System.Exception ex)
            {
                MessageBox.Show("failed  : " + ex.ToString());
            }
        }
 /// <summary>
 /// 如果构造函数不抛异常,url就可以用
 /// </summary>
 /// <param name="ftpInfo"></param>
 /// <param name="enable_ssh"></param>
 public CExternalFtpManage(CFtpServerInfo ftpInfo, bool enable_ssh = true)
     : base(ftpInfo, enable_ssh)
 {
 }
 public CPrivateFtpManage(CFtpServerInfo ftpInfo, bool enable_ssh = true)
     : base(ftpInfo, enable_ssh)
 {
 }