internal static IList <TreeNodeData> GetThreads(WindowCache wc, MainForm mf, Process parent, bool visibleOnly) { List <TreeNodeData> result = new List <TreeNodeData>(); if (parent == null) { foreach (Process p in Process.GetProcesses()) { foreach (ProcessThread t in p.Threads) { if (!visibleOnly || wc.IsThreadVisible(t)) { result.Add(new ThreadData(mf, p, t)); } } } } else { foreach (ProcessThread t in parent.Threads) { if (!visibleOnly || wc.IsThreadVisible(t)) { result.Add(new ThreadData(mf, parent, t)); } } } return(result); }
internal static bool HasThreadsOrBelow(WindowCache wc, MainForm mf, Process process, bool visibleOnly) { if (mf.DisplayThreads) { if (process == null) { return(true); // there must be at least the thread executing this code :) } if (visibleOnly) { foreach (ProcessThread pt in process.Threads) { if (wc.IsThreadVisible(pt)) { return(true); } } return(false); } return(process.Threads.Count > 0); } else { return(WindowData.HasWindowsOrBelow(wc, mf, process, null, visibleOnly)); } }