コード例 #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();*/
        }