public void RefreshProcesses() { PortDefinition[] ports = null; switch (m_portFilter) { case PortFilter.Emulator: #if USE_CONNECTION_MANAGER ports = this.DebugPortSupplier.Manager.EnumeratePorts(m_portFilter); #else ports = Emulator.EnumeratePipes(); #endif break; case PortFilter.Serial: case PortFilter.Usb: case PortFilter.TcpIp: ports = GetPersistablePortDefinitions(); break; default: Debug.Assert(false); throw new ApplicationException(); } ArrayList processes = new ArrayList(m_alProcesses.Count + ports.Length); for (int i = ports.Length - 1; i >= 0; i--) { PortDefinition portDefinition = (PortDefinition)ports[i]; CorDebugProcess process = EnsureProcess(portDefinition); processes.Add(process); } for (int i = m_alProcesses.Count - 1; i >= 0; i--) { CorDebugProcess process = (CorDebugProcess)m_alProcesses[i]; if (!processes.Contains(process)) { RemoveProcess(process); } } }
static public ArrayList Enumerate(params PortFilter[] args) { ArrayList lst = new ArrayList(); foreach (PortFilter pf in args) { PortDefinition[] res; switch (pf) { case PortFilter.Emulator: res = Emulator.EnumeratePipes(); break; case PortFilter.Serial: res = AsyncSerialStream.EnumeratePorts(); break; case PortFilter.LegacyPermiscuousWinUsb: case PortFilter.Usb: { res = WinUsb_AsyncUsbStream.EnumeratePorts(pf == PortFilter.LegacyPermiscuousWinUsb); lst.AddRange(res); res = AsyncUsbStream.EnumeratePorts(); // res will be added to list below... } break; case PortFilter.TcpIp: res = PortDefinition_Tcp.EnumeratePorts(); break; default: res = null; break; } if (res != null) { lst.AddRange(res); } } return(lst); }