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