//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// protected int CreatePort(IDebugPortRequest2 portRequest, out IDebugPort2 port) { LoggingUtils.PrintFunction(); try { string requestPortName; LoggingUtils.RequireOk(portRequest.GetPortName(out requestPortName)); if (string.IsNullOrWhiteSpace(requestPortName)) { throw new InvalidOperationException("Invalid/empty port name"); } AndroidDevice device = AndroidAdb.GetConnectedDeviceById(requestPortName); if (device == null) { throw new InvalidOperationException("Failed to find a device with the name: " + requestPortName); } port = new DebuggeePort(this, device); return(Constants.S_OK); } catch (Exception e) { LoggingUtils.HandleException(e); port = null; return(Constants.E_FAIL); } }
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// public DebuggeeProcess(DebuggeePort port, AndroidProcess androidProcess) { m_debuggeePort = port; DebuggeeProgram = new DebuggeeProgram(this); Guid = Guid.NewGuid(); NativeProcess = androidProcess; }