//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// public int EnumPorts(out IEnumDebugPorts2 ppEnum) { // // Retrieves a list of all the ports supplied by a port supplier. // LoggingUtils.PrintFunction(); try { IDebugPort2 [] ports = new IDebugPort2 [m_registeredPorts.Count]; m_registeredPorts.Values.CopyTo(ports, 0); ppEnum = new DebugPortEnumerator(ports); return(Constants.S_OK); } catch (Exception e) { LoggingUtils.HandleException(e); ppEnum = null; return(Constants.E_FAIL); } }
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// public int EnumPorts(out IEnumDebugPorts2 ppEnum) { // // Retrieves a list of all the ports supplied by a port supplier. // LoggingUtils.PrintFunction(); try { AndroidAdb.Refresh(); AndroidDevice [] connectedDevices = AndroidAdb.GetConnectedDevices(); foreach (AndroidDevice device in connectedDevices) { IDebugPort2 ppPort; LoggingUtils.RequireOk(AddPort(new DevicePortRequest(device), out ppPort)); } IDebugPort2 [] ports = new IDebugPort2 [m_registeredPorts.Count]; m_registeredPorts.Values.CopyTo(ports, 0); ppEnum = new DebugPortEnumerator(ports); return(Constants.S_OK); } catch (Exception e) { LoggingUtils.HandleException(e); ppEnum = null; return(Constants.E_FAIL); } }