コード例 #1
0
        /*
         * private void TempUploadThread(Object obj)
         * {
         *  var strs = obj as String[];
         *  var localFilePath = strs[0];
         *  var remoteFileName = strs[1];
         *
         *  var ftpSite = CurrentFtpSiteData.GetFtpSite();
         *  ftpSite.UploadFile(remoteFileName, localFilePath);
         *  String logStr = String.Format("已传送: {0} {1} 于 {2} 秒 ({3}/秒)"
         *                              , remoteFileName
         *                              , IoHelper.GetFileLengthLevelString(ftpSite.TotalDataLength, 2)
         *                              , ftpSite.TransferUsedTime.TotalSeconds.ToString("N2")
         *                              , IoHelper.GetFileLengthLevelString(Convert.ToInt64(ftpSite.AverageTransferSpeed), 1));
         *  LogHelper.PushLog(logStr, Color.FromArgb(128, 0, 0));
         *  this.BeginInvoke(new ThreadHelper.UnnamedDelegate(delegate
         *  {
         *      HidenStatusToolStripItems();
         *  }));
         *  RefreshRemote();
         * }
         */

        private void lvServer_DragDrop(object sender, DragEventArgs e)
        {
            if (CurrentFtpClient == null)
            {
                return;
            }
            String[] PathArray = e.Data.GetData(DataFormats.FileDrop) as String[];

            foreach (var path in PathArray)
            {
                var subItem = new TransferQueueItem(CurrentFtpClient);
                subItem.Type       = TransferQueueItem.TransferQueueItemTypeEnum.Upload;
                subItem.LocalPath  = path;
                subItem.RemotePath = (CurrentFolderPath + "/" + IoHelper.GetFileOrFolderName(path, Path.DirectorySeparatorChar)).Replace("//", "/");
                CurrentTransferQueue.AddToQueue(subItem);
            }
            CurrentTransferQueue.StartQueue();
        }