Adapting to non-static nature of ProcessBuilder
This commit is contained in:
@@ -43,18 +43,26 @@ namespace Password_Manager
|
|||||||
Close();
|
Close();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void CopyAndNotify(string line)
|
private void CopyAndNotify(string? line, string fileName)
|
||||||
{
|
{
|
||||||
Clipboard.SetText(line);
|
ProcessBuilder pb = new ProcessBuilder();
|
||||||
|
pb.ProcessFailed += (e) => MessageBox.Show(e.ToString(), "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
ProcessBuilder.ProcessFailed += (e) => MessageBox.Show(e.ToString(), "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
if (line != null)
|
||||||
ProcessBuilder.Run("./ToastNotification.exe", $"\"{fileName} decrypted\" \"Password copied to clipboard\"");
|
{
|
||||||
|
Clipboard.SetText(line);
|
||||||
|
pb.Run("./ToastNotification.exe", $"\"{fileName} decrypted\" \"Password copied to clipboard\"");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
pb.Run("./ToastNotification.exe", "\"Error\" \"No password copied\"");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void Decrypt(object sender, EventArgs e)
|
private void Decrypt(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
ProcessBuilder.ProcessFailed += (e) => MessageBox.Show(e.ToString(), "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
ProcessBuilder pb = new ProcessBuilder();
|
||||||
CopyAndNotify(ProcessBuilder.GetOutput("gpg.exe", $"--quiet --decrypt {PathRequest()}\\{ResultList.Text}"));
|
pb.ProcessFailed += (e) => MessageBox.Show(e.ToString(), "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
|
CopyAndNotify(pb.GetOutput("gpg.exe", $"--quiet --decrypt {PathRequest()}\\{ResultList.Text}"), ResultList.Text);
|
||||||
Close();
|
Close();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -31,7 +31,7 @@
|
|||||||
|
|
||||||
public static string? New(string recipient, int length, bool no_symbols = false)
|
public static string? New(string recipient, int length, bool no_symbols = false)
|
||||||
{
|
{
|
||||||
return ProcessBuilder.GetOutput("cmd.exe" $"echo {RandomStr(length, no_symbols)} | gpg --quiet --encrypt --recipient {recipient}");
|
return new ProcessBuilder().GetOutput("cmd.exe", $"echo {RandomStr(length, no_symbols)} | gpg --quiet --encrypt --recipient {recipient}");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user