// Copy a list of files and/or directories from a drag-drop operation to the user's local working directory public static void CopyFiles(object sender, DoWorkEventArgs e) { BackgroundWorker worker = sender as BackgroundWorker; List <object> args = e.Argument as List <object>; string[] filenames = args[0] as string[]; string classification = args[1] as string; if (filenames != null && filenames.Length > 0) { try { // Sort files and dirs ArrayList fileList = new ArrayList(); ArrayList dirList = new ArrayList(); foreach (string filename in filenames) { if (Directory.Exists(filename)) { dirList.Add(filename); } else if (File.Exists(filename)) { fileList.Add(filename); } } string targetPath = MOG_ControllerLibrary.ConstructPathFromLibraryClassification(classification); // Simply copy the files foreach (string dirname in dirList) { string target = Path.Combine(targetPath, Path.GetFileName(dirname)); MOG_ControllerSystem.DirectoryCopyEx(dirname, target, worker); } // Simply copy the files foreach (string filename in fileList) { string target = Path.Combine(targetPath, Path.GetFileName(filename)); MOG_ControllerSystem.FileCopyEx(filename, target, true, true, worker); } } catch { } } }