Ejemplo n.º 1
0
        public static InstproxyError GetApplications(IntPtr installProxyClient, selectApp selectForm, out List<iOSApplication> appList)
        {
            IntPtr clientOptions = instproxy_client_options_new();
            instproxy_client_options_add(clientOptions, "ApplicationType", "Any", IntPtr.Zero);

            selectForm.BeginInvoke(new MethodInvoker(delegate () { selectForm.loadingBar.PerformStep(); }));

            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;
            }

            selectForm.BeginInvoke(new MethodInvoker(delegate () { selectForm.loadingBar.PerformStep(); }));

            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 identifier = getAttribute(currElement, "CFBundleIdentifier");

                iOSApplication newApp = new iOSApplication(type, name, version, identifier, executableName);
                appList.Add(newApp);
            }

            return returnCode;
        }
Ejemplo n.º 2
0
        public static InstproxyError GetApplications(IntPtr installationProxyClient, selectApp selectForm, out List<IOsApplication> appList)
        {
            IntPtr clientOptionsList = instproxy_client_options_new();
            instproxy_client_options_add(clientOptionsList, "ApplicationType", "Any", IntPtr.Zero);

            selectForm.BeginInvoke(new MethodInvoker(delegate() { selectForm.loadingBar.PerformStep(); }));

            IntPtr resultPlist;
            InstproxyError returnCode = instproxy_browse(installationProxyClient, clientOptionsList, out resultPlist);

            selectForm.BeginInvoke(new MethodInvoker(delegate() { selectForm.loadingBar.PerformStep(); }));

            XDocument resultXml = LibiMobileDevice.PlistToXml(resultPlist);
            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 = currElement.Descendants("key").Where(x => x.Value == "CFBundleShortVersionString")
                    .Select(x => (x.NextNode as XElement).Value).FirstOrDefault();

                if (version == null || version == "")
                {
                    version = currElement.Descendants("key").Where(x => x.Value == "CFBundleVersion")
                        .Select(x => (x.NextNode as XElement).Value).FirstOrDefault();
                }

                string name = currElement.Descendants("key").Where(x => x.Value == "CFBundleName")
                    .Select(x => (x.NextNode as XElement).Value).FirstOrDefault();
                string executableName = currElement.Descendants("key").Where(x => x.Value == "CFBundleExecutable")
                    .Select(x => (x.NextNode as XElement).Value).FirstOrDefault();

                if (name == null || name == "")
                {
                    name = executableName;
                }

                string type = currElement.Descendants("key").Where(x => x.Value == "ApplicationType")
                    .Select(x => (x.NextNode as XElement).Value).FirstOrDefault();

                IOsApplication newApp = new IOsApplication(type, name, version,
                    currElement.Descendants("key").Where(x => x.Value == "CFBundleIdentifier").Select(x => (x.NextNode as XElement).Value).FirstOrDefault(),
                    executableName);
                appList.Add(newApp);
            }

            return returnCode;
        }