public static List <iDevice> GetDevices() { IntPtr devicesPtr; int count; LibiMobileDevice.IDeviceError returnCode = LibiMobileDevice.idevice_get_device_list(out devicesPtr, out count); List <iDevice> deviceList = new List <iDevice>(); if (returnCode != LibiMobileDevice.IDeviceError.IDEVICE_E_SUCCESS || devicesPtr == IntPtr.Zero || count == 0 || Marshal.ReadInt32(devicesPtr) == 0) { return(deviceList); } string currUdid; int i = 0; while ((currUdid = Marshal.PtrToStringAnsi(Marshal.ReadIntPtr(devicesPtr, i))) != null) { deviceList.Add(new iDevice(currUdid)); i = i + 4; } LibiMobileDevice.idevice_device_list_free(devicesPtr); return(deviceList); }
public void Connect() { IntPtr deviceHandle; LibiMobileDevice.IDeviceError returnCode = LibiMobileDevice.NewDevice(out deviceHandle, Udid); if (returnCode != LibiMobileDevice.IDeviceError.IDEVICE_E_SUCCESS || deviceHandle == IntPtr.Zero) { return; } handle = deviceHandle; }