Example #1
0
 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);
 }