void listView_DragDrop(object sender, DragEventArgs e) { string[] imgFiles = GetDraggedBitmapFile(e); if (imgFiles == null) { return; } string dir = TerrainEditor.AbsoluteBrushFilePath; bool bAnyExists = false; string exists = ""; string[] tgtNames = new string[imgFiles.Length]; int i = 0; foreach (string filename in imgFiles) { string relname = Path.GetFileName(filename); tgtNames[i] = Path.Combine(dir, relname); if (File.Exists(tgtNames[i])) { bAnyExists = true; exists += "\n" + relname; } i++; } if (bAnyExists) { if (EditorManager.ShowMessageBox("A file named\n" + exists + "\n\nalready exists in the target directory.\n\nSelect 'Yes' to overwrite or 'No' to abort", "Overwrite files?", MessageBoxButtons.YesNo, MessageBoxIcon.Question) != DialogResult.Yes) { return; } } // copy the files try { for (i = 0; i < tgtNames.Length; i++) { System.IO.File.Copy(imgFiles[i], tgtNames[i], true); } } catch (Exception ex) { EditorManager.ShowMessageBox("An error occurred while copying file(s):\n" + ex.Message, "File copy error", MessageBoxButtons.OK, MessageBoxIcon.Error); EditorManager.DumpException(ex); return; } TerrainEditor.LoadNewBrushFiles(tgtNames); }