public static string browseForExe(string game) { string exeName = Get_EXE_Name(game); if (!Guard.IsStringValid(exeName)) { return(""); } MessageBox.Show("Please browse for " + exeName + ".\n\nMake sure that your game is UNMODDED, otherwise Toolbox will make a corrupt backup"); ConsoleHandler.append("Make sure that your game is UNMODDED, otherwise Toolbox will make a corrupt backup.."); string exePath = BrowseForFile("Open game exe", "exe", "Exe files (*.exe)|*.exe|All files (*.*)|*.*", ""); if (!Guard.IsStringValid(exePath)) { ConsoleHandler.append_Force("Invalid EXE path!"); return(""); } if (!exePath.Contains(exeName)) { ConsoleHandler.append("You selected an Invalid .exe. Please browse for the exe for your game."); return(""); } string gameDir = exePath.Replace("\\" + exeName, ""); SaveGamePath(game, gameDir); return(gameDir); }
private void ShowLastBattlesPass_Click(object sender, EventArgs e) { string pass = ""; if (CurrentProjectVariables.GameName == "BTDB") { if (CurrentProjectVariables.JetPassword != "" && CurrentProjectVariables.JetPassword != null) { pass = CurrentProjectVariables.JetPassword; } } else if (Serializer.cfg.battlesPass != null && Serializer.cfg.battlesPass != "") { pass = Serializer.cfg.battlesPass; } if (pass != null && pass != "") { ConsoleHandler.append_Force("The last password you used for BTDB is: " + pass); DialogResult diag = MessageBox.Show("Would you like toolbox to copy it to your clipboard? It will overwrite whatever is currently copied?", "Copy to clipboard?", MessageBoxButtons.YesNo); if (diag == DialogResult.Yes) { Clipboard.SetText(pass); ConsoleHandler.append("The password has been automatically copied to your clipboard so you can paste it easily."); } else { ConsoleHandler.append("The password was not copied to clipboard... You can see it in the messages above"); } } else { ConsoleHandler.append_Force("You don't have a battles password saved... Next time you make a new project, make sure to check \"Remember Password\""); } }
private void SaveEditorToolStripMenuItem_MouseHover(object sender, EventArgs e) { if (!seMessageShown) { seMessageShown = true; ConsoleHandler.append_Force("This save editor was originally made by Vadmeme on github. They're allowing anyone to use it, so we added it to toolbox."); ConsoleHandler.append_Force("If you're interested, the link for it is here: https://github.com/Vadmeme/BTDSaveEditor"); } }
private void MonkeyWrenchToolStripMenuItem_MouseHover(object sender, EventArgs e) { if (!mwMessageShown) { mwMessageShown = true; ConsoleHandler.append_Force("Monkey Wrench is a great tool made by Topper, that allows you to convert .jpng files into regular .png files, and back again."); ConsoleHandler.append_Force("Once it's opened, type \'help\' without quotes, to learn how to use the commands."); } }
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(); }
private void GetSubtaskNum() { string subtaskNum = JSON_Reader.GetSubtaskNum(CharIndex_UnderMouse, Editor_TextBox.Text); if (subtaskNum != "" && subtaskNum != " " && subtaskNum != null) { ConsoleHandler.append_Force_CanRepeat("Subtask: [" + subtaskNum + " ]"); } else { ConsoleHandler.append_Force("Unable to detect subtask. Please try clicking somewhere else..."); } }
private void DisableAutoformattinhToolStripMenuItem_Click(object sender, EventArgs e) { if (Serializer.cfg.autoFormatJSON == true) { ConsoleHandler.append("Auto-formatting disabled."); ConsoleHandler.force_append_Notice("You can enable or disable this in Settings, " + "which you can find under the \"File\" button at the top of toolbox."); Serializer.cfg.autoFormatJSON = false; Serializer.SaveSettings(); } else { ConsoleHandler.append_Force("It is already disabled. You can use it manually by pressing the \"Re-format JSON\" button above. " + "Or, you can change it in Settings, which you can find under the \"File\" button at the top of toolbox."); } }
private void ShowBMCPass_Button_Click(object sender, EventArgs e) { string pass = "******"; ConsoleHandler.append_Force("The password for BMC's data.jet is: Q%_{6#Px]]\n>> Make sure you don't copy it with spaces in it"); DialogResult diag = MessageBox.Show("Would you like toolbox to copy it to your clipboard? It will overwrite whatever is currently copied?", "Copy to clipboard?", MessageBoxButtons.YesNo); if (diag == DialogResult.Yes) { Clipboard.SetText(pass); ConsoleHandler.append("The password has been automatically copied to your clipboard so you can paste it easily."); } else { ConsoleHandler.append("The password was not copied to clipboard... You can see it in the messages above"); } }
private void jsonContextClicked(object sender, ToolStripItemClickedEventArgs e) { if (e.ClickedItem.Text == "Paste") { try { Editor_TextBox.SelectionStart = CharIndex_UnderMouse; Editor_TextBox.Paste(); } catch (Exception) { } } if (e.ClickedItem.Text == "Find subtask") { try { ConsoleHandler.force_append_Notice("Please enter the subtask numbers you are looking for in the \"Find\" text box above.\n>> Example: 0,0,1"); searchSubtask = true; ShowFindMenu(); } catch (Exception) { } } if (e.ClickedItem.Text == "Get current subtask number") { if (jsonError == false) { try { //func here GetSubtaskNum(); } catch (Exception) { } } else { ConsoleHandler.append_Force("JSON error detected... You need to fix the JSON error before you can get the subtask"); } } }
private void GetSubtaskNum() { if (jsonError == false) { string subtaskNum = JSON_Reader.GetSubtaskNum(CharIndex_UnderMouse, Editor_TextBox.Text); if (subtaskNum != "" && subtaskNum != " " && subtaskNum != null) { ConsoleHandler.append_Force_CanRepeat("Subtask: [" + subtaskNum + " ]"); } else { ConsoleHandler.append_Force_CanRepeat("Unable to detect subtask. Please try clicking somewhere else..."); this.Focus(); } } else { ConsoleHandler.append_Force("JSON error detected... You need to fix the JSON error before you can get the subtask"); } }
private void CheckIfModified(string pathToFile) { string backupfile = Environment.CurrentDirectory + "\\Backups\\" + CurrentProjectVariables.GameName + "_Original.jet"; if (!File.Exists(pathToFile) || !File.Exists(backupfile)) { if (JetProps.get().Count <= 0) { return; } if (!File.Exists(pathToFile)) { ConsoleHandler.append_Force("Can't check if file is modified because the file itself was not found. Was it deleted?"); } else if (!File.Exists(backupfile)) { ConsoleHandler.append_Force("Can't check if file is modified because the backup was not found"); } return; } ZipFile backup = new ZipFile(backupfile); backup.Password = CurrentProjectVariables.JetPassword; string modText = RemoveWhitespace(File.ReadAllText(pathToFile)); string pathInZip = pathToFile.Replace(CurrentProjectVariables.PathToProjectFiles + "\\", ""); string originalText = RemoveWhitespace(ProjectHandler.ReadTextFromZipFile(backup, pathInZip)); try { if (modText == originalText) { //file not modded if (CurrentProjectVariables.ModifiedFiles.Contains(pathToFile)) { CurrentProjectVariables.ModifiedFiles.Remove(pathToFile); } } else { //file modded if (!CurrentProjectVariables.ModifiedFiles.Contains(pathToFile)) { CurrentProjectVariables.ModifiedFiles.Add(pathToFile); } } } catch { //exception occurred. file probably modded if (!CurrentProjectVariables.ModifiedFiles.Contains(pathToFile)) { CurrentProjectVariables.ModifiedFiles.Add(pathToFile); } } ProjectHandler.SaveProject(); }
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();*/ }