/// <summary> /// Creates a new iPhone object. If an iPhone is connected to the computer, a connection will automatically be opened. /// </summary> public iPhone() { AMDeviceNotification notification; int ret = 0; dnc = new DeviceNotificationCallback(NotifyCallback); drn1 = new DeviceRestoreNotificationCallback(DfuConnectCallback); drn2 = new DeviceRestoreNotificationCallback(RecoveryConnectCallback); drn3 = new DeviceRestoreNotificationCallback(DfuDisconnectCallback); drn4 = new DeviceRestoreNotificationCallback(RecoveryDisconnectCallback); notification = new AMDeviceNotification(); ret = MobileDevice.AMDeviceNotificationSubscribe(dnc, 0, 0, 0, ref notification); if (ret != 0) { throw new Exception("AMDeviceNotificationSubscribe failed with error " + ret); } ret = MobileDevice.AMRestoreRegisterForDeviceNotifications(drn1, drn2, drn3, drn4, 0, IntPtr.Zero); if (ret != 0) { throw new Exception("AMRestoreRegisterForDeviceNotifications failed with error " + ret); } current_directory = "/"; }
/// <summary> /// Creates a new iPhone object. If an iPhone is connected to the computer, a connection will automatically be opened. /// </summary> public iPhone() { AMDeviceNotification notification; int ret = 0; dnc = new DeviceNotificationCallback(NotifyCallback); drn1 = new DeviceRestoreNotificationCallback(DfuConnectCallback); drn2 = new DeviceRestoreNotificationCallback(RecoveryConnectCallback); drn3 = new DeviceRestoreNotificationCallback(DfuDisconnectCallback); drn4 = new DeviceRestoreNotificationCallback(RecoveryDisconnectCallback); notification = new AMDeviceNotification(); ret = MobileDevice.AMDeviceNotificationSubscribe(dnc, 0, 0, 0, ref notification); if (ret != 0) { throw new Exception("AMDeviceNotificationSubscribe failed with error " + ret); } ret = MobileDevice.AMRestoreRegisterForDeviceNotifications(drn1, drn2, drn3, drn4, 0, IntPtr.Zero); if (ret != 0) { throw new Exception("AMRestoreRegisterForDeviceNotifications failed with error " + ret); } current_directory = "/"; }
public static int AMDeviceNotificationSubscribe(DeviceNotificationCallback callback, uint unused1, uint unused2, uint unused3, ref AMDeviceNotification notification) { IntPtr ptr; int ret; ptr = IntPtr.Zero; ret = AMDeviceNotificationSubscribe(callback, unused1, unused2, unused3, ref ptr); if ((ret == 0) && (ptr != IntPtr.Zero)) { notification = (AMDeviceNotification)Marshal.PtrToStructure(ptr, notification.GetType()); } return ret; }
public static int AMDeviceNotificationSubscribe(DeviceNotificationCallback callback, uint unused1, uint unused2, uint unused3, ref AMDeviceNotification notification) { IntPtr ptr; int ret; ptr = IntPtr.Zero; ret = AMDeviceNotificationSubscribe(callback, unused1, unused2, unused3, ref ptr); if ((ret == 0) && (ptr != IntPtr.Zero)) { notification = (AMDeviceNotification)Marshal.PtrToStructure(ptr, notification.GetType()); } return(ret); }