Ejemplo n.º 1
0
        public override bool Equals(object obj)
        {
            ToolTreeNode ttn = (ToolTreeNode)obj;

            if (this.type == ttn.type && this.fullPath.ToLower() == ttn.fullPath.ToLower())
            {
                return(true);
            }

            return(false);
        }
Ejemplo n.º 2
0
        private void SelectNode(ToolTreeNode node)
        {
            this.FilesTreeView.SelectedNode = node;
            this.selectedNode = node;

            this.btnGetExecutable.Enabled = false;
            if (node != null && node.type == ToolTreeNodeType.File)
            {
                btnGetExecutable.Enabled = true;
            }
        }
Ejemplo n.º 3
0
        private void btnDefault_Click(object sender, System.EventArgs e)
        {
            this.FilesTreeView.Nodes.Clear();
            ToolTreeNode defaultNode = new ToolTreeNode("[ProjectPath]\\MOG\\Tools\\PC\\LaunchExplorerWin\\LaunchExplorerWin.exe", ToolTreeNodeType.File);

            this.FilesTreeView.Nodes.Add(defaultNode);
            SelectNode(defaultNode);
            btnGetExecutable_Click(sender, e);
            this.CopyToToolsCheckBox.Checked = false;
            btnOK_Click(sender, e);
        }
Ejemplo n.º 4
0
        private void btnAddFolder_Click(object sender, System.EventArgs e)
        {
            FolderBrowserDialog fbd = new FolderBrowserDialog();

            fbd.Description = "Select tool folder";

            if (fbd.ShowDialog() == DialogResult.OK)
            {
                ToolTreeNode newNode = ToolTreeNode.EncodeDirectory(fbd.SelectedPath);
                newNode.ImageIndex         = 1;
                newNode.SelectedImageIndex = 1;
                this.FilesTreeView.Nodes.Add(newNode);
            }
        }
Ejemplo n.º 5
0
        private void btnExecutableBrowse_Click(object sender, System.EventArgs e)
        {
            // add the executable to FilesListView so it can be copied correctly
            OpenFileDialog ofd = new OpenFileDialog();

            ofd.Title       = "Select startup executable";
            ofd.Multiselect = false;
            if (ofd.ShowDialog() == DialogResult.OK)
            {
                ToolTreeNode newNode = new ToolTreeNode(ofd.FileName, ToolTreeNodeType.File);
                this.FilesTreeView.Nodes.Add(newNode);
                SelectNode(newNode);
                btnGetExecutable_Click(sender, e);
            }
        }
Ejemplo n.º 6
0
        public bool ContainsNodeRecursive(ToolTreeNode node)
        {
            if (this == node)
            {
                return(true);
            }

            foreach (ToolTreeNode ttn in this.Nodes)
            {
                if (ttn.ContainsNodeRecursive(node))
                {
                    return(true);
                }
            }

            return(false);
        }
Ejemplo n.º 7
0
 private void btnRemove_Click(object sender, System.EventArgs e)
 {
     if (this.selectedNode != null)
     {
         if (this.selectedNode.ContainsNodeRecursive(this.executableNode))
         {
             if (MessageBox.Show("This action will remove the specified startup executable. Do you want to proceed?", "Remove?", MessageBoxButtons.YesNo) == DialogResult.No)
             {
                 return;
             }
             this.executableNode         = null;
             this.executablePath         = "";
             this.ExecutableTextBox.Text = "";
         }
         this.FilesTreeView.SelectedNode.Remove();
     }
 }
Ejemplo n.º 8
0
        private void btnAddFile_Click(object sender, System.EventArgs e)
        {
            OpenFileDialog ofd = new OpenFileDialog();

            ofd.Title       = "Select files";
            ofd.Multiselect = true;
            if (ofd.ShowDialog() == DialogResult.OK)
            {
                foreach (string filename in ofd.FileNames)
                {
                    ToolTreeNode newNode = new ToolTreeNode(filename, ToolTreeNodeType.File);
                    newNode.ImageIndex         = 0;
                    newNode.SelectedImageIndex = 0;
                    this.FilesTreeView.Nodes.Add(newNode);
                }
            }
        }
Ejemplo n.º 9
0
        public CopyToolForm(CopyToolType type, BASE mog)
        {
            //
            // Required for Windows Form Designer support
            //
            InitializeComponent();

            this.mog = mog;

            this.imageList = new ImageList();
            this.imageList.Images.Add((Image) new Bitmap("C:\\Documents and Settings\\jbianchi\\My Documents\\work\\MOG.Net\\MOG_Server\\Server_Gui\\guiConfigurationsHelpers\\fileicon.bmp"));
            this.imageList.Images.Add((Image) new Bitmap("C:\\Documents and Settings\\jbianchi\\My Documents\\work\\MOG.Net\\MOG_Server\\Server_Gui\\guiConfigurationsHelpers\\foldericon.bmp"));
            this.FilesTreeView.ImageList  = this.imageList;
            this.btnGetExecutable.Enabled = false;
            this.selectedNode             = null;
            this.executableNode           = null;

            switch (type)
            {
            case CopyToolType.Ripper:
                this.Text = "Select Ripper Components";
                this.FilesListViewLabel.Text  = "Ripper components";
                this.CopyToToolsCheckBox.Text = "Copy ripper to project \"Tools\" tree";
                break;

            case CopyToolType.RipTasker:
                this.Text = "Select Rip Tasker Components";
                this.FilesListViewLabel.Text  = "Rip tasker components";
                this.CopyToToolsCheckBox.Text = "Copy rip tasker to project \"Tools\" tree";
                break;

            case CopyToolType.Viewer:
                this.Text = "Select Viewer Components";
                this.FilesListViewLabel.Text  = "Viewer components";
                this.CopyToToolsCheckBox.Text = "Copy viewer to project \"Tools\" tree";
                break;

            case CopyToolType.Generic:
                this.Text = "Select Tool Components";
                this.FilesListViewLabel.Text  = "Tool components";
                this.CopyToToolsCheckBox.Text = "Copy tool to project \"Tools\" tree";
                break;
            }

            updateDestFolderLabel();
        }
Ejemplo n.º 10
0
 private void btnGetExecutable_Click(object sender, System.EventArgs e)
 {
     if (this.selectedNode != null)
     {
         if (this.selectedNode.type == ToolTreeNodeType.File)
         {
             this.executableNode         = this.selectedNode;
             this.executablePath         = this.selectedNode.fullPath;
             this.ExecutableTextBox.Text = this.selectedNode.Text;
         }
     }
     else
     {
         this.executableNode         = null;
         this.executablePath         = "";
         this.ExecutableTextBox.Text = "";
     }
 }
Ejemplo n.º 11
0
        public static ToolTreeNode EncodeDirectory(string path)
        {
            DirectoryInfo dinfo = new DirectoryInfo(path);

            if (dinfo.Exists)
            {
                ToolTreeNode ttn = new ToolTreeNode(path, ToolTreeNodeType.Directory);
                foreach (DirectoryInfo dir in dinfo.GetDirectories())
                {
                    ttn.Nodes.Add(ToolTreeNode.EncodeDirectory(dir.FullName));
                }
                foreach (FileInfo file in dinfo.GetFiles())
                {
                    ttn.Nodes.Add(new ToolTreeNode(file.FullName, ToolTreeNodeType.File));
                }

                return(ttn);
            }
            return(null);
        }
Ejemplo n.º 12
0
        private void btnOK_Click(object sender, System.EventArgs e)
        {
            if (this.executablePath == null || this.executablePath == "" || this.ExecutableTextBox.Text == "")
            {
                MessageBox.Show("Please specify the executable that starts this tool", "Missing executable");
                return;
            }

            if (CopyToToolsCheckBox.Checked)
            {
                //
                // copy the tool to the Tools tree
                //

                string copyPath = this.mog.GetProject().GetProjectToolsPath();
                while (copyPath.EndsWith("\\"))
                {
                    copyPath = copyPath.Substring(0, copyPath.Length - 1);
                }

                try
                {
                    if (CreateSubdirCheckbox.Checked)
                    {
                        // we need to create a special subdir for this tool in the Tools tree
                        if (CreateSubdirTextBox.Text != "")
                        {
                            copyPath = string.Concat(copyPath, "\\", CreateSubdirTextBox.Text);
                            if (!Directory.Exists(copyPath))
                            {
                                if (!Directory.CreateDirectory(copyPath).Exists)
                                {
                                    MessageBox.Show("Couldn't create specified tool directory, please re-enter it", "Directory creation error");
                                }
                            }
                        }
                    }
                }
                catch (Exception) { MessageBox.Show("Couldn't create specified tool directory, please re-enter it", "Directory creation error"); return; }

                // okay, now we're ready to copy the files to 'copyPath'
                try
                {
                    int numFiles = 0;
                    foreach (ToolTreeNode ttn in this.FilesTreeView.Nodes)
                    {
                        numFiles += ttn.GetNumFilesRecursive();
                    }

                    try
                    {
                        this.fcnf           = new FileCopyNotifierForm(numFiles);
                        this.fcnf.TitleText = "File Copy Progress";
                        this.fcnf.Show();
                        this.Enabled = false;
                        CopySpecifiedFiles(this.FilesTreeView.Nodes, copyPath);
                        this.Enabled = true;
                        this.fcnf.Close();
                        this.fcnf = null;
                    }
                    catch (FileCopyNotifierFormAbortedByUserException)
                    {
                        this.Enabled = true;
                        fcnf.Close();
                        fcnf = null;
                        MessageBox.Show("Tool copy cancelled", "Copy Abort");
                        return;
                    }
                }
                catch (Exception excp)
                {
                    MessageBox.Show(string.Concat("An error occured in copying the files/folders specified:\n\n", excp.Message), "File copy error");
                }

                // build the proper executable path backwards, starting from the filename and working
                //  through its parent dirs
                this.executablePath = this.executableNode.name;
                ToolTreeNode exNode = (ToolTreeNode)this.executableNode.Parent;
                while (exNode != null)
                {
                    this.executablePath = string.Concat(exNode.name, "\\", this.executablePath);
                    exNode = (ToolTreeNode)exNode.Parent;
                }
                this.executablePath = string.Concat(copyPath, "\\", this.executablePath);
            }

            this.DialogResult = DialogResult.OK;
            this.Close();
        }