/// <summary> /// Called when [get process list]. /// </summary> /// <returns>OnGetProcessListResponse object.if successful return a array of process running on target include important information from each one else return error</returns> public static OnGetProcessListResponse OnGetProcessList() { OnGetProcessListResponse JOnGetProcessList = new OnGetProcessListResponse(); Process[] ProcessList = Process.GetProcesses(); Utils._s_Utils_ErrosHandling ErrorHandling = new Utils._s_Utils_ErrosHandling(); foreach (Process process in ProcessList) { OnGetProcessListResponse.Process JProcess = new OnGetProcessListResponse.Process(); ErrorHandling.OnErrorResumeNext( () => { JProcess.Id = process.Id; }, () => { JProcess.ProcessOwner = GetProcessUser(process); }, () => { JProcess.ProcessName = process.ProcessName; }, () => { JProcess.BasePriority = process.BasePriority; }, () => { JProcess.MainModule = process.MainModule.FileName; }, () => { JProcess.MainWindowHandle = process.MainWindowHandle; }, () => { JProcess.StartTime = process.StartTime; }, () => { JOnGetProcessList.process.Add(JProcess); } ); } JOnGetProcessList.Errors = ErrorHandling; return(JOnGetProcessList); }
private void OnGetProcessList(string ResponseToOnGetProcessList) { OnGetProcessListResponse ProcessList = _m_Process_Manager.OnGetProcessList(); mocm.HubsManager.GetHub("CommandHub").Invoke(ResponseToOnGetProcessList, ProcessList); }