예제 #1
0
        private void CreateProject_Button_Click(object sender, EventArgs e)
        {
            string projectJet = Environment.CurrentDirectory + "\\" + CurrentProjectVariables.GameName + "_Original.jet";

            bool result = GeneralMethods.Bad_JetPass(projectJet, Password_TextBox.Text);

            if (!result)
            {
                ConsoleHandler.append("Password correct");
                CurrentProjectVariables.JetPassword = Password_TextBox.Text;
                ProjectHandler.SaveProject();

                if (Dont_Ask_Again_Checkbox.Checked)
                {
                    ZipForm.rememberedPassword = Password_TextBox.Text;
                    Serializer.SaveSettings();
                }

                var zip = new ZipForm();
                zip.password = Password_TextBox.Text;
                zip.Show();

                if (isExtracting)
                {
                    zip.Extract();
                }
                else
                {
                    zip.launch = launch;
                    zip.Compile();
                }
                this.Close();
            }
            else
            {
                ConsoleHandler.append_Force("You entered a bad password. Please check your password and try again");
            }

            /*
             * string projectJet = CurrentProjectVariables.PathToProjectClassFile + "\\" + CurrentProjectVariables.ProjectName + ".jet";
             *
             * if (File.Exists(projectJet))
             * {
             *
             * }
             * else
             * {
             *  ConsoleHandler.append_Force("Your project file was not detected...");
             * }*/

            //GetPass();
        }
예제 #2
0
        public void GetPass()
        {
            string password = Password_TextBox.Text.ToString();

            if (password.Length < 3)
            {
                ConsoleHandler.append("The password you entered was too short...");
                MessageBox.Show("The password you entered was too short...");
            }
            else
            {
                ConsoleHandler.append("You entered the password:  "******"BTDB";
                zip.password     = password;
                zip.projName     = projName;
                zip.Show();

                if (Dont_Ask_Again_Checkbox.Checked)
                {
                    rememberPass = true;
                    ConsoleHandler.append("Program will remember your password for the rest of this session.");
                    ZipForm.rememberedPassword = Password_TextBox.Text;
                }
                else
                {
                    rememberPass = false;
                    ZipForm.rememberedPassword = "";
                }
                if (isExtracting == true)
                {
                    zip.Extract();
                }
                else
                {
                    zip.destPath = destPath;
                    zip.launch   = launch;
                    zip.Compile();
                }
                this.Close();
            }
        }
예제 #3
0
        private void SubmitModName()
        {
            if (CustomName_RadioButton.Checked)
            {
                ConsoleHandler.append("You chose the project name: " + ProjectName_TextBox.Text);
            }
            else
            {
                ConsoleHandler.append("You chose a random project name");
            }
            if (isRenaming == true)
            {
                this.Hide();
                RenameProject();
                this.Close();
                return;
            }

            bool   writeProj = true;
            string projName  = ReturnName(ProjectName_TextBox.Text, gameName);
            string projdir   = "";

            if (Guard.IsStringValid(customFolder))
            {
                projdir = customFolder + "\\" + projName;
            }
            else
            {
                projdir = Environment.CurrentDirectory + "\\Projects\\" + projName;
            }

            if (Directory.Exists(projdir))
            {
                var result = MessageBox.Show("A project with this name already exists, do you want to replace it with a new one?", "Replace Existing Project?", MessageBoxButtons.YesNoCancel);
                if (result == DialogResult.Cancel)
                {
                    writeProj = false;
                    this.Close();
                }
                else
                {
                    if (result == DialogResult.Yes)
                    {
                        ConsoleHandler.append("Deleting original project");
                        try
                        {
                            Directory.Delete(projdir, true);
                        }
                        catch { ConsoleHandler.append("Directory is currently open in windows file explorer..."); }
                        writeProj = true;
                    }
                    else
                    {
                        writeProj = false;
                        ProjectName_TextBox.Text = "";
                    }
                }
            }

            if (writeProj == true)
            {
                if (!Directory.Exists(projdir))
                {
                    Directory.CreateDirectory(projdir);
                }

                string backupPath = Environment.CurrentDirectory + "\\Backups\\" + CurrentProjectVariables.GameName + "_Original.jet";
                if (!GeneralMethods.Validate_Backup(gameName))
                {
                    GeneralMethods.CreateBackup(gameName);
                }

                if (File.Exists(backupPath))
                {
                    if (!Directory.Exists(projdir))
                    {
                        Directory.CreateDirectory(projdir);
                    }

                    CurrentProjectVariables.ProjectName            = projName;
                    CurrentProjectVariables.PathToProjectClassFile = projdir;
                    CurrentProjectVariables.PathToProjectFiles     = projdir + "\\" + projName;
                    CurrentProjectVariables.UseNKHook = UseNKH_CB.Checked;
                    ProjectHandler.SaveProject();

                    if (gameName == "BTDB")
                    {
                        var getPasss = new Get_BTDB_Password();
                        getPasss.Show();
                        getPasss.isExtracting = true;
                        this.Close();
                    }
                    else
                    {
                        var zip = new ZipForm();
                        zip.Show();
                        zip.Extract();
                        this.Close();
                    }
                }
                else
                {
                    ConsoleHandler.append_Force("Unable to locate or create backup... Cancelling project creation...");
                    if (Directory.Exists(projdir))
                    {
                        Directory.Delete(projdir);
                    }
                    this.Close();
                }
            }

            //This stuff is for zip projects

            /*if (gameName != "BTDB")
             * {
             *  CurrentProjectVariables.JetPassword = "******";
             *  ProjectHandler.SaveProject();
             *
             *  DirectoryInfo dinfo = new DirectoryInfo(projdir);
             *  jetf = new JetForm(dinfo, Main.getInstance(), dinfo.Name);
             *  jetf.MdiParent = Main.getInstance();
             *  jetf.Show();
             *  jetf.PopulateTreeview();
             * }
             * else
             * {
             *  var getPasss = new Get_BTDB_Password();
             *  getPasss.Show();
             * }
             * this.Close();*/
        }
예제 #4
0
        public static void CompileJet(string switchCase)
        {
            if (New_JsonEditor.isJsonError != true)
            {
                if (JetProps.get().Count == 1)
                {
                    string dest         = "";
                    bool   isOutputting = false;
                    bool   abort        = false;

                    var zip = new ZipForm();

                    if (switchCase.Contains("output"))
                    {
                        isOutputting = true;
                        string exPath = CurrentProjectVariables.ExportPath;
                        if (exPath != "" && exPath != null)
                        {
                            DialogResult diag = MessageBox.Show("Do you want export to the same place as last time?", "Export to the same place?", MessageBoxButtons.YesNo);
                            if (diag == DialogResult.Yes)
                            {
                                dest = exPath;
                            }
                            else
                            {
                                exPath = "";
                            }
                        }
                        if (exPath == "" || exPath == null)
                        {
                            ConsoleHandler.append("Select where you want to export your jet file. Make sure to give it a name..");
                            dest = OutputJet();

                            CurrentProjectVariables.ExportPath = dest;
                            ProjectHandler.SaveProject();

                            //ZipForm.savedExportPath = dest;
                            //Serializer.SaveSmallSettings("export path");
                        }
                        zip.destPath = dest;
                    }


                    else if (switchCase.Contains("launch"))
                    {
                        if (switchCase.Contains("nkh"))
                        {
                            zip.launchNKH = true;
                        }

                        if (CurrentProjectVariables.GamePath != null && CurrentProjectVariables.GamePath != "")
                        {
                            zip.launch   = true;
                            zip.destPath = CurrentProjectVariables.GamePath + "\\Assets\\" + ReturnJetName(CurrentProjectVariables.GameName);
                        }
                        else
                        {
                            ConsoleHandler.force_append_Notice("Unable to find your game directory, and therefore, unable to launch. Do you want to try browsing for your game?");
                            DialogResult diag = MessageBox.Show("Unable to find your game directory, and therefore, unable to launch. Do you want to try browsing for your game?", "Browse for game?", MessageBoxButtons.YesNoCancel);
                            if (diag == DialogResult.Yes)
                            {
                                browseForExe(CurrentProjectVariables.GameName);
                            }
                            if (diag == DialogResult.No)
                            {
                                DialogResult diag2 = MessageBox.Show("Do you want to just save your jet file instead?", "Save jet instead?", MessageBoxButtons.YesNo);
                                {
                                    if (diag2 == DialogResult.Yes)
                                    {
                                        isOutputting = true;
                                        string exPath = CurrentProjectVariables.ExportPath;
                                        if (exPath != "" && exPath != null)
                                        {
                                            DialogResult diagz = MessageBox.Show("Do you want export to the same place as last time?", "Export to the same place?", MessageBoxButtons.YesNo);
                                            if (diagz == DialogResult.Yes)
                                            {
                                                dest = exPath;
                                            }
                                            else
                                            {
                                                exPath = "";
                                            }
                                        }
                                        if (exPath == "" || exPath == null)
                                        {
                                            ConsoleHandler.append("Select where you want to export your jet file. Make sure to give it a name..");
                                            dest = OutputJet();
                                            CurrentProjectVariables.ExportPath = dest;
                                            ProjectHandler.SaveProject();

                                            /*ZipForm.savedExportPath = dest;
                                             * Serializer.SaveSmallSettings("export path");*/
                                        }
                                        zip.destPath = dest;
                                    }
                                }
                            }
                            else
                            {
                                abort = true;
                            }
                        }
                    }
                    if (!abort)
                    {
                        if (isOutputting)
                        {
                            if (dest != null && dest != "")
                            {
                                zip.destPath = dest;
                                zip.Show();
                                zip.Compile();
                            }
                            else
                            {
                                ConsoleHandler.append("Export cancelled...");
                            }
                        }
                        else
                        {
                            zip.Show();
                            zip.Compile();
                        }
                    }
                }
                else
                {
                    if (JetProps.get().Count < 1)
                    {
                        MessageBox.Show("You have no .jets or projects open, you need one to launch.");
                        ConsoleHandler.append("You need to open a project to continue...");
                    }
                    else
                    {
                        MessageBox.Show("You have multiple .jets or projects open, only one can be launched.");
                        ConsoleHandler.append("You need to close projects to continue...");
                    }
                }
            }
        }