private void StartFileTransfer(string targetDriveKey, string targetDirectoryKey) { string driveKey; StringCollection fileDropList; var moveMode = false; if (Clipboard.ContainsFileDropList()) { fileDropList = Clipboard.GetFileDropList(); if (fileDropList.Count == 0) { return; } driveKey = Path.GetPathRoot(fileDropList[0]); if (String.IsNullOrEmpty(driveKey)) { return; } } else if (Clipboard.ContainsData(ClipboardDataType)) { var hdfsFileTransfer = Clipboard.GetData(ClipboardDataType) as StringCollection; if (hdfsFileTransfer == null || hdfsFileTransfer.Count < 2) { return; } driveKey = hdfsFileTransfer[0]; hdfsFileTransfer.RemoveAt(0); if (hdfsFileTransfer[0] == MoveModeToken) { moveMode = true; hdfsFileTransfer.RemoveAt(0); } fileDropList = hdfsFileTransfer; } else { return; } var sourceDrive = _drives[driveKey]; var form = new FileTransferForm(sourceDrive, fileDropList, _drives[targetDriveKey], targetDirectoryKey, moveMode); form.Closed += (s, e) => { if (moveMode && fileDropList.Count > 0) { var sourceDirectoryKey = fileDropList[0] .Substring(0, fileDropList[0].LastIndexOf(sourceDrive.PathDelimiter)); RefreshDriveEntries(driveKey, sourceDirectoryKey); } RefreshDriveEntries(targetDriveKey, targetDirectoryKey); }; form.Show(); }
private void StartFileTransfer(string targetDriveKey, string targetDirectoryKey) { string driveKey; StringCollection fileDropList; var moveMode = false; if (Clipboard.ContainsFileDropList()) { fileDropList = Clipboard.GetFileDropList(); if (fileDropList.Count==0) return; driveKey = Path.GetPathRoot(fileDropList[0]); if (String.IsNullOrEmpty(driveKey)) return; } else if (Clipboard.ContainsData(ClipboardDataType)) { var hdfsFileTransfer = Clipboard.GetData(ClipboardDataType) as StringCollection; if (hdfsFileTransfer == null || hdfsFileTransfer.Count < 2) return; driveKey = hdfsFileTransfer[0]; hdfsFileTransfer.RemoveAt(0); if (hdfsFileTransfer[0] == MoveModeToken) { moveMode = true; hdfsFileTransfer.RemoveAt(0); } fileDropList = hdfsFileTransfer; } else return; var sourceDrive = _drives[driveKey]; var form = new FileTransferForm(sourceDrive, fileDropList, _drives[targetDriveKey], targetDirectoryKey, moveMode); form.Closed += (s, e) => { if (moveMode && fileDropList.Count>0) { var sourceDirectoryKey = fileDropList[0] .Substring(0, fileDropList[0].LastIndexOf(sourceDrive.PathDelimiter)); RefreshDriveEntries(driveKey, sourceDirectoryKey); } RefreshDriveEntries(targetDriveKey, targetDirectoryKey); }; form.Show(); }