Exemple #1
0
        /// <summary>
        /// Edit the ripper in notepad
        /// </summary>
        private void EditRipper()
        {
            if (this.PropertiesList.Length > 0)
            {
                MOG_Properties properties = PropertiesList[0] as MOG_Properties;

                // Get the assigned ripper information
                string ripper = properties.AssetRipper;
                string tool   = DosUtils.FileStripArguments(properties.AssetRipper);
                string args   = DosUtils.FileGetArguments(properties.AssetRipper);

                // Do we have a ripper to edit?
                if (ripper.Length > 0)
                {
                    // Locate the ripper
                    ripper = MOG_ControllerSystem.LocateTool("", tool);
                    if (ripper.Length > 0)
                    {
                        // Edit the ripper
                        guiCommandLine.ShellSpawn("Notepad.exe", ripper);
                    }
                    else
                    {
                        // If not, do we want to create one?
                        if (MOG_Prompt.PromptResponse("No Ripper Found", "This appears to be a new ripper.\n" +
                                                      "RIPPER: " + tool + "\n\n" +
                                                      "Would you like to create a new one for editing?", MOGPromptButtons.YesNo) == MOGPromptResult.Yes)
                        {
                            // Create a new one using the user's specified name
                            string defaultRipperName = tool;
                            ripper = Path.Combine(MOG_ControllerProject.GetProject().GetProjectToolsPath(), defaultRipperName);

                            // Do we want to start from the template?
                            if (MOG_Prompt.PromptResponse("Use Ripper Template", "Would you like to base the new ripper from MOG's ripper template?", MOGPromptButtons.YesNo) == MOGPromptResult.Yes)
                            {
                                // If so, copy the template to this new ripper
                                string template = MOG_ControllerSystem.GetSystemRepositoryPath() + "\\Tools\\Rippers\\TemplateComplex_ripper.bat";

                                DosUtils.CopyFast(template, ripper, false);
                            }

                            // Launch the editor
                            string output = "";
                            guiCommandLine.ShellExecute("Notepad.exe", ripper, System.Diagnostics.ProcessWindowStyle.Normal, ref output);

                            // Now, set this new ripper as the ripper assigned to this asset restoring the users args
                            properties.AssetRipper = ripper + " " + args;
                            this.PropertiesRippingRipperComboBox.Text = properties.AssetRipper;
                        }
                    }
                }
                else
                {
                    MOG_Prompt.PromptMessage("Edit Ripper", "There is no ripper to edit.");
                }
            }
        }