public bool TryUninstall(string ApplicationIdentifier) { DateTime StartTime = DateTime.Now; ReconnectWithInstallProxy(); TypedPtr <CFString> CF_ApplicationIdentifier = MobileDevice.CFStringMakeConstantString(ApplicationIdentifier); IntPtr CF_ClientOptions = IntPtr.Zero; IntPtr ExtraKey = IntPtr.Zero; IntPtr ExtraValue = IntPtr.Zero; IntPtr ConnectionHandle = IntPtr.Zero; int Result = MobileDevice.AMDeviceMethods.SecureUninstallApplication(ConnectionHandle, iPhoneHandle, CF_ApplicationIdentifier, CF_ClientOptions, UninstallProgressCallback, IntPtr.Zero); if (Result == 0) { Console.WriteLine("Uninstall of \"{0}\" completed successfully in {2:0.00} seconds", ApplicationIdentifier, Result, (DateTime.Now - StartTime).TotalSeconds); } else { Console.WriteLine("Uninstall of \"{0}\" failed with {1} in {2:0.00} seconds", ApplicationIdentifier, MobileDevice.GetErrorString(Result), (DateTime.Now - StartTime).TotalSeconds); } return(Result == 0); }
public bool ConnectToBundle(string BundleName) { Reconnect(); TypedPtr <CFString> CFBundleName = MobileDevice.CFStringMakeConstantString(BundleName); // Open the bundle int Result = MobileDevice.AMDeviceMethods.StartHouseArrestService(iPhoneHandle, CFBundleName, IntPtr.Zero, ref hService, 0); if (Result != 0) { Console.WriteLine("Failed to connect to bundle '{0}' with {1}", BundleName, MobileDevice.GetErrorString(Result)); return(false); } // Open a file sharing connection if (MobileDevice.AFC.ConnectionOpen(hService, 0, out AFCCommsHandle) != 0) { return(false); } return(true); }
/// <summary> /// Try to update an IPA on the mobile device (it must have already been copied to the PublicStaging directory, with the same filename as the path passed in) /// </summary> public bool TryUpgrade(string IPASourcePathOnPC) { DateTime StartTime = DateTime.Now; ReconnectWithInstallProxy(); IntPtr LiveConnection = IntPtr.Zero; IntPtr ClientOptions = IntPtr.Zero; TypedPtr <CFURL> UrlPath = MobileDevice.CreateFileUrlHelper(IPASourcePathOnPC, false); string UrlPathAsString = MobileDevice.GetStringForUrl(UrlPath); int Result = MobileDevice.AMDeviceMethods.SecureUpgradeApplication(LiveConnection, iPhoneHandle, UrlPath, ClientOptions, InstallProgressCallback, IntPtr.Zero); if (Result == 0) { Console.WriteLine("Install \\ Update of \"{0}\" finished in {2:0.00} seconds", Path.GetFileName(IPASourcePathOnPC), Result, (DateTime.Now - StartTime).TotalSeconds); } else { Console.WriteLine("Install \\ Update of \"{0}\" failed with {1} in {2:0.00} seconds", Path.GetFileName(IPASourcePathOnPC), MobileDevice.GetErrorString(Result), (DateTime.Now - StartTime).TotalSeconds); } return(Result == 0); }