basic functionality done finally
This commit is contained in:
@@ -1,3 +1,5 @@
|
||||
using System.Diagnostics;
|
||||
|
||||
namespace Password_Manager
|
||||
{
|
||||
sealed public partial class MainForm : Form
|
||||
@@ -9,7 +11,12 @@ namespace Password_Manager
|
||||
this.PathRequest = PathRequest;
|
||||
InitializeComponent();
|
||||
|
||||
ResultList = new PasswordListBox(PathRequest);
|
||||
ResultList.SearchQueryRequest += () => SearchBox.Text;
|
||||
ResultList.ReloadResults();
|
||||
}
|
||||
|
||||
private void ReloadResults(object? sender, EventArgs? e) //proxy method for SearchBox.TextChanged
|
||||
{
|
||||
ResultList.ReloadResults();
|
||||
}
|
||||
|
||||
@@ -18,5 +25,36 @@ namespace Password_Manager
|
||||
GeneratePassword gp = new GeneratePassword(SearchBox.Text, PathRequest());
|
||||
gp.ShowDialog();
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user