public static object GetAppValue(string key, NSString applicationId) { if (key == null) { throw new ArgumentNullException("key"); } else if (applicationId == null) { throw new ArgumentNullException("applicationId"); } IntPtr valuePtr; using (var cfKey = new CFString(key)) { valuePtr = CFPreferencesCopyAppValue(cfKey.Handle, applicationId.Handle); } if (valuePtr == IntPtr.Zero) { return(null); } using (var plist = new CFPropertyList(valuePtr, true)) { return(plist.Value); } }
/// <summary> /// 获取已经安装的IPA程序Plist /// </summary> /// <returns></returns> public unsafe string GetInstalledList() { IntPtr result = new IntPtr(); int i = MobileDevice.AMDeviceLookupApplications(this.iPhoneHandle, IntPtr.Zero, ref result); CoreFoundation.CFPropertyList cfPlist = new CoreFoundation.CFPropertyList(result); CoreFoundation.CFArray xx = new CoreFoundation.CFArray(); return(cfPlist.ToString()); }
/// <summary> /// 获取已经安装的IPA程序Plist /// </summary> /// <returns></returns> public unsafe string GetInstalledList() { IntPtr result = new IntPtr(); int i = MobileDevice.AMDeviceLookupApplications(this.iPhoneHandle,IntPtr.Zero,ref result); CoreFoundation.CFPropertyList cfPlist = new CoreFoundation.CFPropertyList(result); CoreFoundation.CFArray xx = new CoreFoundation.CFArray(); return cfPlist.ToString(); }
private IntPtr[] GrabTheData(string Response) { IntPtr[] ret = new IntPtr[5]; string temp; temp = Response.Remove(0, Response.IndexOf("<plist version") - 1); temp = temp.Remove((temp.IndexOf(@"</Protocol>")), temp.Length - ((temp.IndexOf(@"</Protocol>")))); string headers = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n<!DOCTYPE plist PUBLIC \"-//Apple//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/PropertyList-1.0.dtd\">"; temp = headers + "\r\n" + temp; if (File.Exists(Environment.CurrentDirectory + @"\wildcard.ticket") == true) { File.Delete(Environment.CurrentDirectory + @"\wildcard.ticket"); } System.IO.File.AppendAllText(Environment.CurrentDirectory + @"\wildcard.ticket", temp); CFPropertyList plist = new CFPropertyList(Environment.CurrentDirectory + @"\wildcard.ticket"); CFDictionary plist_to_dict = (IntPtr)plist; CFDictionary iphone_activation = (IntPtr)plist_to_dict.GetValue("iphone-activation"); CFDictionary dict = (IntPtr)iphone_activation.GetValue("activation-record"); ret[0] = dict.GetValue("AccountTokenCertificate"); ret[1] = dict.GetValue("AccountToken"); ret[2] = dict.GetValue("FairPlayKeyData"); ret[3] = dict.GetValue("DeviceCertificate"); ret[4] = dict.GetValue("AccountTokenSignature"); if (File.Exists(Environment.CurrentDirectory + @"\wildcard.ticket") == true) { File.Delete(Environment.CurrentDirectory + @"\wildcard.ticket"); } return ret; }