public void MogControl_LibraryTreeView_DragDrop(object sender, DragEventArgs args) { if (this.dragOverNode != null) { // Restore node's original colors this.dragOverNode.BackColor = SystemColors.Window; this.dragOverNode.ForeColor = SystemColors.ControlText; } // Get node we want to drop at TreeNode targetNode = this.GetNodeAt(this.PointToClient(new Point(args.X, args.Y))); // and select it so it'll show up in the ListView this.SelectedNode = targetNode; if (args.Data.GetDataPresent("FileDrop")) { // Extract the filenames and import string[] filenames = (string[])args.Data.GetData("FileDrop", false); if (filenames != null && filenames.Length > 0) { bool bCopyFiles = true; bool bAutoAddFiles = false; bool bPromptUser = false; bool bCancel = false; // Check if thes files are coming from the same spot? string classification = targetNode.FullPath; string classificationPath = MOG_ControllerLibrary.ConstructPathFromLibraryClassification(classification); // Get the common directory scope of the items ArrayList items = new ArrayList(filenames); string rootPath = MOG_ControllerAsset.GetCommonDirectoryPath("", items); if (rootPath.StartsWith(classificationPath)) { bCopyFiles = false; } // Check if auto import is checked? if (this.LibraryExplorer.IsAutoImportChecked()) { // Automatically add the file on the server bAutoAddFiles = true; bPromptUser = true; // Check if these files are already within the library? if (MOG_ControllerLibrary.IsPathWithinLibrary(rootPath)) { // Ignore what the user specified and rely on the classification generated from the filenames classification = ""; bPromptUser = false; bCopyFiles = false; } } // Promt the user for confirmation before we import these files if (bPromptUser) { // Prompt the user and allow them to cancel if (LibraryFileImporter.PromptUserForConfirmation(filenames, classification) == false) { bCancel = true; } } // Make sure we haven't canceled if (!bCancel) { if (bCopyFiles) { // Import the files List <object> arguments = new List <object>(); arguments.Add(filenames); arguments.Add(classification); ProgressDialog progress = new ProgressDialog("Copying Files", "Please wait while the files are copied", LibraryFileImporter.CopyFiles, arguments, true); progress.ShowDialog(); } } // Make sure we haven't canceled if (!bCancel) { if (bAutoAddFiles) { // Import the files List <object> arguments = new List <object>(); arguments.Add(filenames); arguments.Add(classification); ProgressDialog progress = new ProgressDialog("Copying Files", "Please wait while the files are copied", LibraryFileImporter.ImportFiles, arguments, true); progress.ShowDialog(); } } // Refresh view DeInitialize(); Initialize(); } } else if (args.Data.GetDataPresent("LibraryListItems")) { ArrayList items = args.Data.GetData("LibraryListItems") as ArrayList; foreach (string item in items) { // Move library asset here MOG_Filename assetName = new MOG_Filename(item); // Check if this was an asset? if (assetName.GetFilenameType() == MOG_FILENAME_TYPE.MOG_FILENAME_Asset) { bool success = MOG_ControllerProject.GetProject().AssetRename(assetName.GetAssetFullName(), SelectedNode.FullPath + assetName.GetAssetName()); // Make sure we unsync this asset just in case it had already been synced MOG_ControllerLibrary.Unsync(assetName); } // Check if this was a file? else if (DosUtils.FileExistFast(item)) { string dstPath = MOG_ControllerLibrary.ConstructPathFromLibraryClassification(SelectedNode.FullPath); string dstTarget = Path.Combine(dstPath, Path.GetFileName(item)); DosUtils.FileMoveFast(item, dstTarget, true); } } } else if (args.Data.GetDataPresent("LibraryTreeNode")) { string classification = args.Data.GetData("LibraryTreeNode") as string; if (classification != null && classification.Length > 0) { //Move classification here string[] parts = classification.Split("~".ToCharArray()); if (parts.Length > 0) { string lastPart = parts[parts.Length - 1]; bool success = MOG_ControllerProject.GetProject().ClassificationRename(classification, SelectedNode.FullPath + "~" + lastPart); } else { MOG_Prompt.PromptResponse("Cannot move classification", "MOG was unable to move the classification", Environment.StackTrace, MOGPromptButtons.OK); } } } }