Making ProcessBuilder non-static

This commit is contained in:
2023-03-31 07:17:11 +02:00
parent 64e4a7a264
commit 97e8468ec2

View File

@@ -5,12 +5,12 @@ namespace Password_Manager
{
public delegate void ProcessSuccess();
public delegate void ProcessFailure(Exception e);
static class ProcessBuilder
sealed class ProcessBuilder
{
public event ProcessSuccess? ProcessFinished;
public event ProcessFailure? ProcessFailed;
public static void Run(string procName, string args)
public void Run(string procName, string args)
{
try
{
@@ -25,12 +25,7 @@ namespace Password_Manager
ClearDelegate()
}
private void ClearDelegate()
{
//clear delegate because static
if (ProcessFinished != null)
{
foreach (ProcessSuccess p in ProcessFinished)
public string? GetOutput(string procName, string args)
{
ProcessFinished -= p;
}