private void InitFileTransferBackgroundWorkerDoWork(object sender, DoWorkEventArgs e) { foreach (var path in _sourcePaths) { switch (_sourceDrive.GetDriveEntryType(path)) { case DriveEntryType.File: _fileTransferQueue.Enqueue(new FileTransferParameters { SourceDrive = _sourceDrive, SourceFilePath = path, TargetDrive = _targetDrive, TargetFilePath = _targetDrive.CombinePath(_targetPath, _sourceDrive.GetFileName(path)) }); break; case DriveEntryType.Directory: if (_moveMode) { _sourcePathsToDelete.Enqueue(path); } foreach (var file in _sourceDrive.GetFiles(path, true)) { _fileTransferQueue.Enqueue(new FileTransferParameters { SourceDrive = _sourceDrive, SourceFilePath = file.Key, TargetDrive = _targetDrive, TargetFilePath = _targetDrive.CombinePath( _targetPath, file.Key .Remove(0, path.LastIndexOf(_sourceDrive.PathDelimiter) + 1) .Replace(_sourceDrive.PathDelimiter, _targetDrive.PathDelimiter)) }); } break; } } }