Last active
January 6, 2020 14:02
-
-
Save SamKr/e6f7bb1005205c1fbc26eb906e27c948 to your computer and use it in GitHub Desktop.
Checks whether the current exec is already running (user agnostic)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static bool IsRunning() | |
{ | |
var proc = Assembly.GetExecutingAssembly().GetName().Name; | |
var processes = Process.GetProcesses().ToList(); | |
var activeProcs = processes.Where(x => x.ProcessName.ToLower() == proc).ToList(); | |
return activeProcs.Count > 1; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment