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();
        }
Example #2
0
        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();
        }
Example #3
0
        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);
            CloneEffectFileCallback callback = new CloneEffectFileCallback(this, selectedFileData);
            CloneDialog dialog = new CloneDialog(selectedFileData.FileName, selectedFileData.GetNameForCloning());
            dialog.SetCallback(callback);
            dialog.ShowDialog();
        }
        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();
        }