/// <summary> /// Queries a device for its build info. </summary> /// <param name="device"> the device to query. </param> private void queryNewDeviceForInfo(Device device) { // TODO: do this in a separate thread. try { // first get the list of properties. device.executeShellCommand(GetPropReceiver.GETPROP_COMMAND, new GetPropReceiver(device)); queryNewDeviceForMountingPoint(device, DeviceConstants.MNT_EXTERNAL_STORAGE); queryNewDeviceForMountingPoint(device, DeviceConstants.MNT_DATA); queryNewDeviceForMountingPoint(device, DeviceConstants.MNT_ROOT); // now get the emulator Virtual Device name (if applicable). if (device.emulator) { EmulatorConsole console = EmulatorConsole.getConsole(device); if (console != null) { device.avdName = console.avdName; } } } catch (TimeoutException) { Log.w("DeviceMonitor", string.Format("Connection timeout getting info for device {0}", device.serialNumber)); } catch (AdbCommandRejectedException e) { // This should never happen as we only do this once the device is online. Log.w("DeviceMonitor", string.Format("Adb rejected command to get device {0} info: {1}", device.serialNumber, e.Message)); } catch (ShellCommandUnresponsiveException) { Log.w("DeviceMonitor", string.Format("Adb shell command took too long returning info for device {0}", device.serialNumber)); } catch (IOException) { Log.w("DeviceMonitor", string.Format("IO Error getting info for device {0}", device.serialNumber)); } }
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET: //ORIGINAL LINE: private void queryNewDeviceForMountingPoint(final Device device, final String name) throws TimeoutException, AdbCommandRejectedException, ShellCommandUnresponsiveException, java.io.IOException //JAVA TO C# CONVERTER WARNING: 'final' parameters are not allowed in .NET: private void queryNewDeviceForMountingPoint(Device device, string name) { var tempVar = new MultiLineReceiverAnonymousInnerClassHelper(); /*tempVar.isCancelledDelegateInstance = * () => { * return false; * };*/ tempVar.processNewLinesDelegateInstance = (string[] lines) => { foreach (string line in lines) { if (line.Length > 0) { // this should be the only one. device.setMountingPoint(name, line); } } }; device.executeShellCommand("echo $" + name, tempVar); }
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET: //ORIGINAL LINE: private void queryNewDeviceForMountingPoint(final Device device, final String name) throws TimeoutException, AdbCommandRejectedException, ShellCommandUnresponsiveException, java.io.IOException //JAVA TO C# CONVERTER WARNING: 'final' parameters are not allowed in .NET: private void queryNewDeviceForMountingPoint(Device device, string name) { var tempVar = new MultiLineReceiverAnonymousInnerClassHelper(); /*tempVar.isCancelledDelegateInstance = () => { return false; };*/ tempVar.processNewLinesDelegateInstance = (string[] lines) => { foreach (string line in lines) { if (line.Length > 0) { // this should be the only one. device.setMountingPoint(name, line); } } }; device.executeShellCommand("echo $" + name, tempVar); }