Skip to content

Commit

Permalink
quick cleanup on IPlatform
Browse files Browse the repository at this point in the history
  • Loading branch information
Valkirie committed May 31, 2023
1 parent 3f8de43 commit 37cdaab
Showing 1 changed file with 4 additions and 11 deletions.
15 changes: 4 additions & 11 deletions ControllerCommon/Platforms/IPlatform.cs
Original file line number Diff line number Diff line change
Expand Up @@ -52,12 +52,9 @@ protected Process Process
return null;

_Process = processes.FirstOrDefault();
if (_Process.HasExited)
return null;

_Process.EnableRaisingEvents = true;

_Process.Exited += _Process_Exited;
_Process.Disposed += _Process_Disposed;

return _Process;
}
Expand All @@ -68,14 +65,10 @@ protected Process Process
}
}

private void _Process_Disposed(object sender, EventArgs e)
{
_Process = null;
}

private void _Process_Exited(object sender, EventArgs e)
{
_Process.Dispose();
_Process = null;
}

public bool IsInstalled;
Expand Down Expand Up @@ -142,10 +135,10 @@ public virtual bool IsRunning()
{
try
{
if (Process is null)
if (_Process is null)
return false;

return !Process.HasExited;
return !_Process.HasExited;
}
catch { }

Expand Down

0 comments on commit 37cdaab

Please sign in to comment.