stuff
This commit is contained in:
@@ -15,20 +15,21 @@ namespace Password_Manager
|
||||
|
||||
public void Generate(object sender, EventArgs e)
|
||||
{
|
||||
if (passwordName.Text == "" && passwordLength.Text == "")
|
||||
if (passwordName.Text == "" || passwordLength.Text == "")
|
||||
{
|
||||
MessageBox.Show("You must fill in all fields to continue.", "Error: Empty fields", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
|
||||
bool valid = false;
|
||||
while (!valid)
|
||||
else
|
||||
{
|
||||
try
|
||||
{
|
||||
StreamWriter sw = new StreamWriter(currentPath + $"{passwordName.Text}.txt"); //TODO: rename to .gpg when encryption is possible
|
||||
valid = true;
|
||||
sw.Write(Generator.New(Convert.ToInt32(passwordLength.Text), noSymbols.Checked));
|
||||
sw.Close();
|
||||
string filePath = $"{currentPath}\\{passwordName.Text}";
|
||||
File.WriteAllText(
|
||||
currentPath + $"\\{passwordName.Text}.gpg",
|
||||
PasswordGenerator.New(
|
||||
Convert.ToInt32(passwordLength.Text),
|
||||
noSymbols.Checked)
|
||||
);
|
||||
}
|
||||
catch (FormatException)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user