stuff
This commit is contained in:
@@ -1,10 +1,11 @@
|
||||
using System.Text;
|
||||
using System.Diagnostics;
|
||||
using System.Text;
|
||||
|
||||
namespace Password_Generator
|
||||
{
|
||||
static class Generator
|
||||
static class PasswordGenerator
|
||||
{
|
||||
public static string New(int length, bool no_symbols = false)
|
||||
private static string RandomStr(int length, bool no_symbols = false)
|
||||
{
|
||||
StringBuilder builder = new StringBuilder();
|
||||
Random rnd = new Random();
|
||||
@@ -30,5 +31,39 @@ namespace Password_Generator
|
||||
|
||||
return builder.ToString();
|
||||
}
|
||||
|
||||
public static string New(int length, bool no_symbols = false)
|
||||
{
|
||||
File.WriteAllText(@".\\", RandomStr(length, no_symbols));
|
||||
|
||||
try
|
||||
{
|
||||
Process proc = new Process()
|
||||
{
|
||||
StartInfo = new ProcessStartInfo
|
||||
{
|
||||
FileName = "echo", //TODO: pipe the return value of RandomStr to gpg with the --quiet --encrypt --recipient {recipient} flags
|
||||
//Arguments = $"--quiet --decrypt {filePath}",
|
||||
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);
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user