private void aliasContextMenuDuplicate_Click(object sender, EventArgs e) { TreeNode selectedNode = treeView.SelectedNode; FileData selectedFileData = ModuleDataManager.GetInstance().GetSelectedFileData(treeView.SelectedNode); if (selectedFileData == null) { return; } IModuleFileData moduleFile = selectedFileData as IModuleFileData; if (moduleFile == null) { return; // Don't know how to clone something not module file data } // Get the correct type from any descendant nodes (including grandchildren) string manifestEntryType = selectedNode.FullPath.Split('\\')[1]; string sourceModName = selectedNode.FullPath.Split('\\')[0]; ModuleFile sourceModule = moduleFile.GetModuleFile(); string uri = sourceModule != null ? sourceModule.FullAlias : selectedFileData.FileName; CloneAliasCallback callback = new CloneAliasCallback(this, selectedFileData, manifestEntryType); CloneDialog dialog = new CloneDialog(uri, selectedFileData.GetNameForCloning(), sourceModName); dialog.SetCallback(callback); dialog.ShowDialog(); }
public bool OnAccept(CloneObjectParameters parameters) { // Do the cloning string originalName = mFileData.GetNameForCloning(); string potentialNewNodeName = parameters.TransformParameter(originalName); if (potentialNewNodeName.Length <= 1) { MessageBox.Show("You must enter a name longer than 1 character for the clone!"); return(false); } if (potentialNewNodeName.Equals(originalName)) { MessageBox.Show("You must enter a new unique name for the clone!"); return(false); } HashSet <string> dependencies = ModuleDataManager.GetInstance().PreviewCloneDependencies(mFileData, parameters); HashSet <string> savedUnwantedItems = mPreviewCallback != null?mPreviewCallback.GetSavedUnwantedItems() : null; mPreviewCallback = new PreviewCloneFileCallback(mViewer, mFileData, parameters); mPreviewCallback.SetUnwantedItems(savedUnwantedItems); PreviewCloneDialog dialog = new PreviewCloneDialog("Creating " + potentialNewNodeName, dependencies, mPreviewCallback); DialogResult result = dialog.ShowDialog(); if (result != DialogResult.OK) { return(false); } return(true); }
private void aliasContextMenuDuplicate_Click(object sender, EventArgs e) { TreeNode selectedNode = treeView.SelectedNode; FileData selectedFileData = ModuleDataManager.GetInstance().GetSelectedFileData(treeView.SelectedNode); if (selectedFileData == null) { return; } IModuleFileData moduleFile = selectedFileData as IModuleFileData; if (moduleFile == null) { return; // Don't know how to clone something not module file data } string name = moduleFile.GetModuleFile() != null?moduleFile.GetModuleFile().FullAlias : selectedFileData.FileName; CloneAliasCallback callback = new CloneAliasCallback(this, selectedFileData); CloneDialog dialog = new CloneDialog(name, selectedFileData.GetNameForCloning()); dialog.SetCallback(callback); dialog.ShowDialog(); }
private void cloneToolStripMenuItem_Click(object sender, EventArgs e) { TreeView treeView = GetTreeView(treeViewTabControl.SelectedIndex); TreeNode selectedNode = treeView.SelectedNode; string filePath = selectedNode.Tag != null?selectedNode.Tag.ToString() : null; if (filePath == null) { MessageBox.Show("Invalid effect file!"); return; } FileData selectedFileData = GetFileDataFromPath(filePath); char separator = '\\'; if (!selectedNode.FullPath.Contains('\\')) { // For cubemitters the paths were being retrieved as filepaths, not nodepaths // so do this to retrieve the source mod name correctly separator = '/'; } string sourceModName = selectedNode.FullPath.Split(separator)[0]; CloneEffectFileCallback callback = new CloneEffectFileCallback(this, selectedFileData); CloneDialog dialog = new CloneDialog(selectedFileData.FileName, selectedFileData.GetNameForCloning(), sourceModName); dialog.SetCallback(callback); dialog.ShowDialog(); }