public void createNewSecretsFile() { var secretData = new SecretData(); var fileName = "What is the new file name".askUser(); if (fileName.valid()) { if (fileName.extension(".xml").isFalse()) fileName+=".xml"; selectedFile = directory.getCurrentDirectory().pathCombine(fileName); secretData.serialize(selectedFile); statusMessage("Created new File: {0}".format(selectedFile)); } }
public void saveLoadedSecretsFile() { if (selectedFile.valid().isFalse()) { statusMessage("Error: no file loaded"); return; } dataGridView.enabled(false); var secretData = new SecretData(); foreach (var row in dataGridView.rows()) if ((row[0] as string).valid()) secretData.Credentials.createTypeAndAddToList( row[0], row[1], row[2], row[3], row[4]); secretData.serialize(selectedFile); dataGridView.enabled(true); statusMessage("Saved to file: {0}".format(selectedFile)); }