private void ViewOriginalToolStripMenuItem_Click(object sender, EventArgs e) { if (!filename.Contains(New_JsonEditor.readOnlyName)) { JsonEditorHandler.OpenOriginalFile(path); } else { ConsoleHandler.append_Notice("You are already looking at the original " + filename.Replace(New_JsonEditor.readOnlyName, "")); } }
private bool CheckForUpdates() { reader = new WebHandler(); try { return(reader.CheckForUpdate(gitURL, "toolbox2019: ", 0, Main.version)); } catch { ConsoleHandler.append_Notice("Something went wrong when checking for updates.. Failed to check for updates"); return(false); } }
public void OpenInFileExplorer() { string[] split = path.Split('\\'); string foldername = path.Replace(split[split.Length - 1], ""); if (!foldername.Contains("BackupProject")) { Process.Start(foldername); } else { ConsoleHandler.append_Notice("Operation cancelled. We don't want you to edit the backup on accident... If you really need to look at it, you can find it in the Backups folder"); } }
public void RestoreToOriginal() { if (!filename.Contains(New_JsonEditor.readOnlyName)) { DialogResult diag = MessageBox.Show("You are trying to restore this file to the original unmodded version. Are you sure you want to do this?", "Restore to original?", MessageBoxButtons.YesNo); if (diag == DialogResult.Yes) { string backupProj = Environment.CurrentDirectory + "\\Backups\\" + CurrentProjectVariables.GameName + "_BackupProject\\" + path.Replace(CurrentProjectVariables.PathToProjectFiles.Replace("\\\\", "\\"), ""); if (File.Exists(backupProj)) { if (path.Contains(".")) { if (File.Exists(path)) { JsonEditorHandler.CloseFile(path); File.Delete(path); } File.Copy(backupProj, path); JsonEditorHandler.OpenFile(path); ConsoleHandler.append_CanRepeat(filename + "has been restored"); } } else { ConsoleHandler.append_CanRepeat("Could not find file in backup project... Unable to restore file"); } } else { ConsoleHandler.append_CanRepeat("User cancelled restore"); } } else { ConsoleHandler.append_Notice("You can't restore this file because it IS the original " + filename.Replace(New_JsonEditor.readOnlyName, "") + " and it is read only"); } }