Esempio n. 1
0
        /// <summary>
        /// Upload local folders and files to FTP server.
        /// </summary>
        public void UploadFoldersAndFiles(IEnumerable <FileSystemInfo> fileSystemInfos,
                                          Uri serverPath)
        {
            if (this.status != FTPClientManagerStatus.Idle)
            {
                throw new ApplicationException("This client is busy now.");
            }

            this.Status = FTPClientManagerStatus.Uploading;

            FTPUploadClient uploadClient = new FTPUploadClient(this);

            // Register the events.
            uploadClient.AllFilesUploadCompleted +=
                new EventHandler(uploadClient_AllFilesUploadCompleted);
            uploadClient.FileUploadCompleted +=
                new EventHandler <FileUploadCompletedEventArgs>(uploadClient_FileUploadCompleted);

            uploadClient.UploadDirectoriesAndFiles(fileSystemInfos, serverPath);
        }
Esempio n. 2
0
        /// <summary>
        /// 上传本地文件夹和文件到FTP服务器
        /// </summary>
        public void UploadFoldersAndFiles(IEnumerable<FileSystemInfo> fileSystemInfos,
            Uri serverPath)
        {
            if (this.status != FTPClientManagerStatus.Idle)
            {
                throw new ApplicationException("This client is busy now.");
            }

            this.Status = FTPClientManagerStatus.Uploading;

            FTPUploadClient uploadClient = new FTPUploadClient(this);

            //注册事件
            uploadClient.AllFilesUploadCompleted +=
                new EventHandler(uploadClient_AllFilesUploadCompleted);
            uploadClient.FileUploadCompleted +=
                new EventHandler<FileUploadCompletedEventArgs>(uploadClient_FileUploadCompleted);

            uploadClient.UploadDirectoriesAndFiles(fileSystemInfos, serverPath);
        }