mirror of
https://github.com/Artemis-RGB/Artemis
synced 2026-11-11 11:26:27 +00:00
Core - Further reduced allocations in process monitor checking
This commit is contained in:
1 parent
d26f62223b
commit
8a1b302e48
2 files changed
+35
-10
No files matched your search
+1
-10
@@ -38,16 +38,7 @@ public class ProcessActivationRequirement : IModuleActivationRequirement
|
||||
/// <inheritdoc />
|
||||
public bool Evaluate()
|
||||
{
|
||||
if (!ProcessMonitor.IsStarted || (ProcessName == null && Location == null))
|
||||
return false;
|
||||
|
||||
IEnumerable<ProcessInfo> processes = ProcessMonitor.Processes;
|
||||
if (ProcessName != null)
|
||||
processes = processes.Where(p => string.Equals(p.ProcessName, ProcessName, StringComparison.InvariantCultureIgnoreCase));
|
||||
if (Location != null)
|
||||
processes = processes.Where(p => string.Equals(Path.GetDirectoryName(p.Executable), Location, StringComparison.InvariantCultureIgnoreCase));
|
||||
|
||||
return processes.Any();
|
||||
return ProcessMonitor.IsProcessRunning(ProcessName, Location);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
|
||||
Reference in new issue
Block a user