Removed code that is now handled separately by ProcessBuilder
This commit is contained in:
@@ -1,5 +1,3 @@
|
|||||||
using System.Diagnostics;
|
|
||||||
|
|
||||||
namespace Password_Manager
|
namespace Password_Manager
|
||||||
{
|
{
|
||||||
sealed public partial class MainForm : Form
|
sealed public partial class MainForm : Form
|
||||||
@@ -47,34 +45,6 @@ namespace Password_Manager
|
|||||||
|
|
||||||
private void Decrypt(object sender, EventArgs e)
|
private void Decrypt(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
string fileName = ResultList.Text;
|
|
||||||
try
|
|
||||||
{
|
|
||||||
Process proc = new Process()
|
|
||||||
{
|
|
||||||
StartInfo = new ProcessStartInfo
|
|
||||||
{
|
|
||||||
FileName = "gpg.exe",
|
|
||||||
Arguments = $"--quiet --decrypt {PathRequest()}\\{fileName}",
|
|
||||||
UseShellExecute = false,
|
|
||||||
RedirectStandardOutput = true,
|
|
||||||
CreateNoWindow = true
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
proc.Start();
|
|
||||||
while (!proc.StandardOutput.EndOfStream)
|
|
||||||
{
|
|
||||||
string line = proc.StandardOutput.ReadLine();
|
|
||||||
Clipboard.SetText(line);
|
|
||||||
Process.Start("./ToastNotification.exe", $"\"{fileName} decrypted\" \"Password copied to clipboard\"");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
MessageBox.Show(ex.ToString(), "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
|
||||||
}
|
|
||||||
|
|
||||||
Close();
|
Close();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,3 @@
|
|||||||
using System.Text;
|
|
||||||
using System.Diagnostics;
|
|
||||||
|
|
||||||
namespace Password_Generator
|
namespace Password_Generator
|
||||||
{
|
{
|
||||||
@@ -34,33 +32,6 @@ namespace Password_Generator
|
|||||||
|
|
||||||
public static string? New(string recipient, int length, bool no_symbols = false)
|
public static string? New(string recipient, int length, bool no_symbols = false)
|
||||||
{
|
{
|
||||||
try
|
|
||||||
{
|
|
||||||
Process proc = new Process()
|
|
||||||
{
|
|
||||||
StartInfo = new ProcessStartInfo
|
|
||||||
{
|
|
||||||
FileName = "cmd.exe", //TODO: pipe the return value of RandomStr to gpg with the --quiet --encrypt --recipient {recipient} flags
|
|
||||||
Arguments = $"echo {RandomStr(length, no_symbols)} | gpg --quiet --encrypt --recipient {recipient}",
|
|
||||||
UseShellExecute = false,
|
|
||||||
RedirectStandardOutput = true,
|
|
||||||
CreateNoWindow = true
|
|
||||||
}
|
|
||||||
};
|
|
||||||
proc.Start();
|
|
||||||
|
|
||||||
StringBuilder builder = new StringBuilder();
|
|
||||||
while (!proc.StandardOutput.EndOfStream)
|
|
||||||
{
|
|
||||||
builder.Append(proc.StandardOutput.ReadLine());
|
|
||||||
}
|
|
||||||
return builder.ToString();
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
MessageBox.Show(ex.ToString(), "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user