Пример #1
0
        public unsafe XDocument RequestProperties(string domain)
        {
            iDevice id = Devices[0];
            IntPtr  currDevice;
            string  currUdid = id.Udid;

            LibiMobileDevice.iDeviceError returnCode = LibiMobileDevice.NewDevice(out currDevice, currUdid);
            IntPtr ldService;
            IntPtr lockdownClient;

            Lockdown.LockdownError lockdownReturnCode = Lockdown.Start(currDevice, out lockdownClient, out ldService);
            if (lockdownReturnCode == Lockdown.LockdownError.LOCKDOWN_E_SUCCESS)
            {
                IntPtr resultPlist;
                Lockdown.LockdownError lderror = Lockdown.lockdownd_get_value(lockdownClient, domain, null, out resultPlist);
                XDocument xd = LibiMobileDevice.PlistToXml(resultPlist);
                Lockdown.FreeClient(lockdownClient);
                Lockdown.FreeService(ldService);
                LibiMobileDevice.idevice_free(currDevice);
                return(xd);
            }
            else
            {
                Lockdown.FreeClient(lockdownClient);
                Lockdown.FreeService(ldService);
                LibiMobileDevice.idevice_free(currDevice);
                throw new iPhoneException("Lockdown Encountered an Error {0}", lockdownReturnCode);
            }
        }
Пример #2
0
        public bool SetProperty(string domain, string key, string value)
        {
            bool    rv = false;
            iDevice id = Devices[0];
            IntPtr  currDevice;
            string  currUdid = id.Udid;

            LibiMobileDevice.iDeviceError returnCode = LibiMobileDevice.NewDevice(out currDevice, currUdid);
            IntPtr ldService;
            IntPtr lockdownClient;

            Lockdown.LockdownError lockdownReturnCode = Lockdown.Start(currDevice, out lockdownClient, out ldService);
            if (lockdownReturnCode == Lockdown.LockdownError.LOCKDOWN_E_SUCCESS)
            {
                IntPtr plistString             = LibiMobileDevice.plist_new_string(value);
                Lockdown.LockdownError lderror = Lockdown.lockdownd_set_value(lockdownClient, domain, key, plistString);
                if (lderror == Lockdown.LockdownError.LOCKDOWN_E_SUCCESS)
                {
                    rv = true;
                }
            }
            Lockdown.FreeClient(lockdownClient);
            Lockdown.FreeService(ldService);
            LibiMobileDevice.idevice_free(currDevice);
            return(rv);
        }
Пример #3
0
        public void UninstallApplication(string applicationBundleIdentifier)
        {
            string  appId = applicationBundleIdentifier;
            iDevice id    = Devices[0];
            IntPtr  currDevice;
            string  currUdid = id.Udid;

            LibiMobileDevice.iDeviceError returnCode = LibiMobileDevice.NewDevice(out currDevice, currUdid);
            IntPtr ldService;
            IntPtr lockdownClient;

            Lockdown.LockdownError lockdownReturnCode = Lockdown.Start(currDevice, out lockdownClient, out ldService);
            IntPtr InstProxyClient;
            IntPtr InstProxyServer;

            InstallationProxy.InstproxyError ipe = InstallationProxy.instproxy_client_start_service(currDevice, out InstProxyClient, out InstProxyServer);
            ipe = InstallationProxy.instproxy_uninstall(InstProxyClient, appId, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero);
            InstallationProxy.instproxy_client_free(InstProxyClient);
            Lockdown.FreeClient(lockdownClient);
            Lockdown.FreeService(ldService);
            LibiMobileDevice.idevice_free(currDevice);
            if (ipe != InstallationProxy.InstproxyError.INSTPROXY_E_SUCCESS)
            {
                throw new iPhoneException("Installation Proxy encountered an error ({0})", ipe);
            }
        }
Пример #4
0
        public List <iOSApplication> GetApplicationList()
        {
            iDevice id = Devices[0];
            IntPtr  currDevice;
            string  currUdid = id.Udid;

            LibiMobileDevice.iDeviceError returnCode = LibiMobileDevice.NewDevice(out currDevice, currUdid);
            IntPtr ldService;
            IntPtr lockdownClient;

            Lockdown.LockdownError lockdownReturnCode = Lockdown.Start(currDevice, out lockdownClient, out ldService);
            IntPtr InstProxyClient;

            InstallationProxy.InstproxyError ipe = InstallationProxy.Connect(currDevice, ldService, out InstProxyClient);
            List <iOSApplication>            appList;

            InstallationProxy.GetApplications(InstProxyClient, out appList);
            Lockdown.FreeClient(lockdownClient);
            Lockdown.FreeService(ldService);
            if (ipe == InstallationProxy.InstproxyError.INSTPROXY_E_SUCCESS)
            {
                InstallationProxy.instproxy_client_free(InstProxyClient);
                LibiMobileDevice.idevice_free(currDevice);
                return(appList);
            }
            else
            {
                throw new iPhoneException("Installation Proxy encountered an error ({0})", ipe);
            }
        }
Пример #5
0
 public void Deactivate()
 {
     if (this.IsConnected)
     {
         iDevice id = Devices[0];
         IntPtr  currDevice;
         string  currUdid = id.Udid;
         LibiMobileDevice.iDeviceError returnCode = LibiMobileDevice.NewDevice(out currDevice, currUdid);
         IntPtr ldService;
         IntPtr lockdownClient;
         Lockdown.LockdownError lockdownReturnCode = Lockdown.Start(currDevice, out lockdownClient, out ldService);
         Lockdown.lockdownd_deactivate(lockdownClient);
         Lockdown.FreeService(ldService);
         Lockdown.FreeClient(lockdownClient);
         LibiMobileDevice.idevice_free(currDevice);
     }
     else
     {
         throw new iPhoneException("Device not connected.");
     }
 }
Пример #6
0
        public void Reboot()
        {
            iDevice id = Devices[0];
            IntPtr  currDevice;
            string  currUdid = id.Udid;

            LibiMobileDevice.iDeviceError returnCode = LibiMobileDevice.NewDevice(out currDevice, currUdid);
            IntPtr ldService;
            IntPtr lockdownClient;

            Lockdown.LockdownError lockdownReturnCode = Lockdown.Start(currDevice, out lockdownClient, out ldService);
            IntPtr diagService;
            IntPtr diagClient;

            iDiagnostics.diagnostics_relay_error_t dre = iDiagnostics.diagnostics_relay_client_start_service(currDevice, out diagClient, out diagService);
            iDiagnostics.diagnostics_relay_restart(diagClient, iDiagnostics.DIAGNOSTICS_RELAY_ACTION_FLAG_DISPLAY_PASS);
            iDiagnostics.diagnostics_relay_client_free(diagClient);
            Lockdown.FreeClient(lockdownClient);
            Lockdown.FreeService(ldService);
            LibiMobileDevice.idevice_free(currDevice);
        }
Пример #7
0
        public void Sleep()
        {
            iDevice id = Devices[0];
            IntPtr  currDevice;
            string  currUdid = id.Udid;

            LibiMobileDevice.iDeviceError returnCode = LibiMobileDevice.NewDevice(out currDevice, currUdid);
            IntPtr ldService;
            IntPtr lockdownClient;

            Lockdown.LockdownError lockdownReturnCode = Lockdown.Start(currDevice, out lockdownClient, out ldService);
            IntPtr diagService;
            IntPtr diagClient;

            iDiagnostics.diagnostics_relay_error_t dre = iDiagnostics.diagnostics_relay_client_start_service(currDevice, out diagClient, out diagService);
            iDiagnostics.diagnostics_relay_sleep(diagClient);
            iDiagnostics.diagnostics_relay_client_free(diagClient);
            Lockdown.FreeClient(lockdownClient);
            Lockdown.FreeService(ldService);
            LibiMobileDevice.idevice_free(currDevice);
        }