Removed code that is now handled separately by ProcessBuilder
This commit is contained in:
@@ -1,5 +1,3 @@
|
||||
using System.Text;
|
||||
using System.Diagnostics;
|
||||
|
||||
namespace Password_Generator
|
||||
{
|
||||
@@ -34,33 +32,6 @@ namespace Password_Generator
|
||||
|
||||
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