// Import a list of files and/or directories from a drag-drop operation to a specific classification public static void ImportFiles(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); } } // Add each directory seperately foreach (string dirname in dirList) { MOG_ControllerLibrary.AddDirectory(dirname, classification); } // Add all the files MOG_ControllerLibrary.AddFiles(fileList, classification); } catch { } } }