private unsafe bool ConnectToPhone() { if (MobileDevice.AMDeviceConnect(this.iPhoneHandle) == 1) { throw new Exception("Phone in recovery mode, support not yet implemented"); } if (MobileDevice.AMDeviceIsPaired(this.iPhoneHandle) == 0) { return(false); } if (MobileDevice.AMDeviceValidatePairing(this.iPhoneHandle) != 0) { return(false); } if (MobileDevice.AMDeviceStartSession(this.iPhoneHandle) == 1) { return(false); } if (0 != MobileDevice.AMDeviceStartService(this.iPhoneHandle, MobileDevice.__CFStringMakeConstantString(MobileDevice.StringToCString("com.apple.afc2")), ref this.hService, null)) { if (0 != MobileDevice.AMDeviceStartService(this.iPhoneHandle, MobileDevice.__CFStringMakeConstantString(MobileDevice.StringToCString("com.apple.afc")), ref this.hService, null)) { return(false); } } else { this.wasAFC2 = true; } if (MobileDevice.AFCConnectionOpen(this.hService, 0, ref this.hAFC) != 0) { return(false); } this.connected = true; return(true); }
public unsafe void sendCommandToDevice(string Command) { MobileDevice.sendCommandToDevice(this.iPhoneHandle, MobileDevice.__CFStringMakeConstantString(MobileDevice.StringToCFString(Command)), 0); }