public void Subscribe(Action<CreatedProcessDescriptor> handler, SCG.IEnumerable<string> names, bool retroactive) { var lowerCaseNames = new ItzWarty.Collections.HashSet<string>(names.Select(FormatProcessName)); foreach (var lowerCaseName in lowerCaseNames) { processSpawnedHandlersByProcessName.Add(lowerCaseName, handler); } if (retroactive) { var processes = processWatcher.FindProcess((p) => lowerCaseNames.Contains(FormatProcessName(p.ProcessName))); foreach (var process in processes) { handler(new CreatedProcessDescriptor(process.ProcessName, process.Id, processProxy.GetParentProcess(process).Id)); } } }
public void Subscribe(Action <CreatedProcessDescriptor> handler, SCG.IEnumerable <string> names, bool retroactive) { var lowerCaseNames = new ItzWarty.Collections.HashSet <string>(names.Select(FormatProcessName)); foreach (var lowerCaseName in lowerCaseNames) { processSpawnedHandlersByProcessName.Add(lowerCaseName, handler); } if (retroactive) { var processes = processWatcher.FindProcess((p) => lowerCaseNames.Contains(FormatProcessName(p.ProcessName))); foreach (var process in processes) { handler(new CreatedProcessDescriptor(process.ProcessName, process.Id, processProxy.GetParentProcess(process).Id)); } } }