Converting to file-scoped namespaces
This commit is contained in:
@@ -1,32 +1,32 @@
|
||||
namespace GUI
|
||||
namespace GUI;
|
||||
|
||||
sealed public partial class MainForm : Form
|
||||
{
|
||||
sealed public partial class MainForm : Form
|
||||
{
|
||||
public event DataRequest PathRequest;
|
||||
public event DataRequest PathRequest;
|
||||
public event DataRequest? RecipientRequest;
|
||||
|
||||
public MainForm(DataRequest PathRequest, DataRequest? RecipientRequest = null)
|
||||
{
|
||||
this.PathRequest = PathRequest;
|
||||
public MainForm(DataRequest PathRequest, DataRequest? RecipientRequest = null)
|
||||
{
|
||||
this.PathRequest = PathRequest;
|
||||
this.RecipientRequest = RecipientRequest;
|
||||
InitializeComponent();
|
||||
InitializeComponent();
|
||||
|
||||
ResultList.SearchQueryRequest += () => SearchBox.Text;
|
||||
ResultList.ReloadResults();
|
||||
}
|
||||
ResultList.SearchQueryRequest += () => SearchBox.Text;
|
||||
ResultList.ReloadResults();
|
||||
}
|
||||
|
||||
private void ReloadResults(object? sender, EventArgs? e) //proxy method for SearchBox.TextChanged
|
||||
{
|
||||
ResultList.ReloadResults();
|
||||
}
|
||||
private void ReloadResults(object? sender, EventArgs? e) //proxy method for SearchBox.TextChanged
|
||||
{
|
||||
ResultList.ReloadResults();
|
||||
}
|
||||
|
||||
private void ReloadResults()
|
||||
{
|
||||
ResultList.ReloadResults();
|
||||
}
|
||||
private void ReloadResults()
|
||||
{
|
||||
ResultList.ReloadResults();
|
||||
}
|
||||
|
||||
private void OpenPasswordGenerator(object sender, EventArgs e)
|
||||
{
|
||||
private void OpenPasswordGenerator(object sender, EventArgs e)
|
||||
{
|
||||
if (RecipientRequest != null)
|
||||
{
|
||||
GeneratePassword gp = new GeneratePassword(PathRequest(), RecipientRequest(), ReloadResults, SearchBox.Text);
|
||||
@@ -36,34 +36,33 @@ namespace GUI
|
||||
{
|
||||
throw new InvalidOperationException("You cannot use the OpenPasswordGenerator method if you instantiated this form without a RecipientRequest event handler.");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void CancelPressed(object sender, EventArgs e)
|
||||
{
|
||||
Close();
|
||||
}
|
||||
private void CancelPressed(object sender, EventArgs e)
|
||||
{
|
||||
Close();
|
||||
}
|
||||
|
||||
private void CopyAndNotify(string? line, string fileName)
|
||||
{
|
||||
ProcessBuilder pb = new ProcessBuilder();
|
||||
pb.ProcessFailed += (e) => MessageBox.Show(e.ToString(), "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
if (line != null)
|
||||
{
|
||||
Clipboard.SetText(line);
|
||||
pb.Run("./ToastNotification.exe", $"\"{fileName} decrypted\" \"Password copied to clipboard\"");
|
||||
}
|
||||
else
|
||||
{
|
||||
pb.Run("./ToastNotification.exe", "\"Error\" \"No password copied\"");
|
||||
}
|
||||
ProcessBuilder pb = new ProcessBuilder();
|
||||
pb.ProcessFailed += (e) => MessageBox.Show(e.ToString(), "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
if (line != null)
|
||||
{
|
||||
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)
|
||||
{
|
||||
ProcessBuilder pb = new ProcessBuilder();
|
||||
private void Decrypt(object sender, EventArgs e)
|
||||
{
|
||||
ProcessBuilder pb = new ProcessBuilder();
|
||||
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();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user