/// <summary> /// Initializes a new iDevice object. /// </summary> unsafe private void doConstruction() { dnc = new DeviceNotificationCallback(NotifyCallback); drn1 = new DeviceRestoreNotificationCallback(DfuConnectCallback); drn2 = new DeviceRestoreNotificationCallback(RecoveryConnectCallback); drn3 = new DeviceRestoreNotificationCallback(DfuDisconnectCallback); drn4 = new DeviceRestoreNotificationCallback(RecoveryDisconnectCallback); void *notification; int ret = MobileDevice.AMDeviceNotificationSubscribe(dnc, 0, 0, 0, out notification); if (ret != 0) { throw new Exception("AMDeviceNotificationSubscribe failed with error " + ret); } ret = MobileDevice.AMRestoreRegisterForDeviceNotifications(drn1, drn2, drn3, drn4, 0, null); if (ret != 0) { throw new Exception("AMRestoreRegisterForDeviceNotifications failed with error " + ret); } current_directory = "/"; }