private void button1_Click(object sender, EventArgs e) { if (string.IsNullOrEmpty(nameTextBox.Text)) { GeneralUtil.Error("You must give your VDF a name"); return; } if (String.IsNullOrEmpty(pathTextBox.Text)) { GeneralUtil.Error("You must give a save path for the VDF"); return; } if (!Directory.Exists(Path.GetDirectoryName(pathTextBox.Text))) { GeneralUtil.Error("The directory where you'd like to save the VDF doesn't exist"); return; } VDF vdf = new VDF(nameTextBox.Text); vdf.Save(pathTextBox.Text); Editor editor = new Editor(menuForm, recent); editor.OpenVDF(vdf); editor.SetPath(pathTextBox.Text); recent.AddItem(pathTextBox.Text); recent.Save(); menuForm.RefreshRecentItems(); editor.Show(); closedByUser = false; Close(); }
static void CreateVDFTest() { PrintInfo("Save Test"); // Get filename filename = GetInput("Filename: "); PrintSuccess("Set filename to: " + filename); // Get vdf name vdfName = GetInput("VDF Name: "); PrintSuccess("Set VDF name to: " + vdfName); // Get string to save stringToWrite = GetInput("String to save: "); PrintSuccess("Set the string to save to: " + stringToWrite); // Get int to save GetIntToSave(); Console.WriteLine(); PrintSuccess("Set the int to save to: " + intToWrite); // Get name of catagory catagoryName = GetInput("Name of first catagory: "); PrintSuccess("Set the first catagory name to: " + catagoryName); // Get string of first catagory catagoryString = GetInput("String inside first catagory: "); PrintSuccess("Set the string inside of the first catagory to: " + catagoryString); // Create and save VDF CreateVDF(); vdf.Save(filename + ".vdf"); PrintSuccess("Saved VDF!"); return; }
private void saveToolStripMenuItem_Click(object sender, EventArgs e) { vdf.Save(savePath); }