Exemplo n.º 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);
            }
        }
Exemplo n.º 2
0
        public static InstproxyError GetApplications(IntPtr installProxyClient, out List <iOSApplication> appList)
        {
            IntPtr clientOptions = instproxy_client_options_new();

            instproxy_client_options_add(clientOptions, "ApplicationType", "Any", IntPtr.Zero);



            IntPtr         resultPlist;
            InstproxyError returnCode = instproxy_browse(installProxyClient, clientOptions, out resultPlist);

            instproxy_client_options_free(clientOptions);

            XDocument resultXml = LibiMobileDevice.PlistToXml(resultPlist);

            appList = new List <iOSApplication>();
            if (returnCode != InstproxyError.INSTPROXY_E_SUCCESS)
            {
                return(returnCode);
            }

            else if (resultPlist == IntPtr.Zero || resultXml == default(XDocument))
            {
                return(InstproxyError.INSTPROXY_E_UNKNOWN_ERROR);
            }



            List <XElement> appElementList = resultXml.Descendants("dict").Where(x => x.Parent.Parent.Name == "plist").ToList();

            appList = new List <iOSApplication>();
            foreach (XElement currElement in appElementList)
            {
                string version = getAttribute(currElement, "CFBundleShortVersionString");
                if (version == null || version == "")
                {
                    version = getAttribute(currElement, "CFBundleVersion");
                }

                string name           = getAttribute(currElement, "CFBundleName");
                string executableName = getAttribute(currElement, "CFBundleExecutable");
                if (name == null || name == "")
                {
                    name = executableName;
                }

                string         type = getAttribute(currElement, "ApplicationType");
                string         applicationIdentifier = getAttribute(currElement, "ApplicationIdentifier");
                string         identifier            = getAttribute(currElement, "CFBundleIdentifier");
                string         staticsize            = getAttribute(currElement, "StaticDiskUsage");
                string         dynsize = getAttribute(currElement, "DynamicDiskUsage");
                iOSApplication newApp  = new iOSApplication(type, name, version, identifier, executableName, applicationIdentifier, staticsize, dynsize);
                appList.Add(newApp);
            }

            return(returnCode);
        }