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); }
public float[] this [NSString key] { get { if (key == null) { throw new ArgumentNullException(nameof(key)); } var a = CFDictionary.GetValue(Dictionary.Handle, key.Handle); return(NSArray.ArrayFromHandle <float> (a, input => { return new NSNumber(input).FloatValue; })); } set { if (key == null) { throw new ArgumentNullException(nameof(key)); } if (value == null) { RemoveValue(key); } else { Dictionary [key] = NSArray.From(value); } } }
public static T[] GetNativeArray <T> (NSDictionary dictionary, NSObject key, Converter <IntPtr, T> converter) { var cfArrayRef = CFDictionary.GetValue(dictionary.Handle, key.Handle); if (cfArrayRef == IntPtr.Zero || CFArray.GetCount(cfArrayRef) == 0) { return(new T [0]); } return(NSArray.ArrayFromHandle(cfArrayRef, converter)); }
protected string GetStringValue(string key) { if (key == null) { throw new ArgumentNullException("key"); } using (var str = new CFString(key)) { return(CFString.FetchString(CFDictionary.GetValue(Dictionary.Handle, str.Handle))); } }
protected T[]? GetArray <T> (NSString key, Func <NativeHandle, T> creator) { if (key is null) { throw new ArgumentNullException(nameof(key)); } var value = CFDictionary.GetValue(Dictionary.Handle, key.Handle); return(NSArray.ArrayFromHandleFunc <T> (value, creator)); }
protected T[]? GetArray <T> (NSString key) where T : NSObject { if (key is null) { throw new ArgumentNullException(nameof(key)); } var value = CFDictionary.GetValue(Dictionary.Handle, key.Handle); return(NSArray.ArrayFromHandle <T> (value)); }
void SetBaseline(CTBaselineClass baselineClass, double offset, NSString infoKey) { var ptr = CFDictionary.GetValue(Dictionary.Handle, infoKey.Handle); var dict = ptr == IntPtr.Zero ? new NSMutableDictionary() : new NSMutableDictionary(ptr); var key = CTBaselineClassID.ToNSString(baselineClass); Adapter.SetValue(dict, key, new NSNumber(offset)); if (ptr == IntPtr.Zero) { Adapter.SetNativeValue(Dictionary, infoKey, (INativeObject)dict); } }
public string[] this [NSString key] { get { if (key == null) { throw new ArgumentNullException(nameof(key)); } var value = CFDictionary.GetValue(Dictionary.Handle, key.Handle); return(NSArray.StringArrayFromHandle(value)); } set { SetArrayValue(key, value); } }
static AccessoryInfo[] ExtractAccessoryInfo (IntPtr ptr, NSString id, NSString description) { using (var array = new CFArray (ptr)) { var res = new AccessoryInfo [array.Count]; for (int i = 0; i < res.Length; ++i) { var dict = array.GetValue (i); var n = new NSNumber (CFDictionary.GetValue (dict, id.Handle)); var desc = CFString.FetchString (CFDictionary.GetValue (dict, description.Handle)); res [i] = new AccessoryInfo ((int) n, desc); id.Dispose (); } return res; } }
protected string?GetStringValue(string key) { if (key is null) { throw new ArgumentNullException(nameof(key)); } var keyHandle = CFString.CreateNative(key); try { return(CFString.FromHandle(CFDictionary.GetValue(Dictionary.Handle, keyHandle))); } finally { CFString.ReleaseNative(keyHandle); } }
protected T[] GetArray <T> (NSString key, Func <IntPtr, T> creator) { if (key == null) { throw new ArgumentNullException("key"); } var value = CFDictionary.GetValue(Dictionary.Handle, key.Handle); if (value == IntPtr.Zero) { return(null); } return(NSArray.ArrayFromHandleFunc <T> (value, creator)); }
protected T[] GetArray <T> (NSString key) where T : NSObject { if (key == null) { throw new ArgumentNullException("key"); } var value = CFDictionary.GetValue(Dictionary.Handle, key.Handle); if (value == IntPtr.Zero) { return(null); } return(NSArray.ArrayFromHandle <T> (value)); }
protected bool?GetBoolValue(NSString key) { if (key == null) { throw new ArgumentNullException("key"); } var value = CFDictionary.GetValue(Dictionary.Handle, key.Handle); if (value == IntPtr.Zero) { return(null); } return(CFBoolean.GetValue(value)); }
public static Hashtable LookupApplication(IntPtr device) { IntPtr ptr = IntPtr.Zero; int b = AMDeviceLookupApplications(device, 0, out ptr); if (b != NO_ERR) { return(null); } int length = CFLibrary.CFDictionaryGetCount(ptr); IntPtr[] keys = new IntPtr[length]; IntPtr[] values = new IntPtr[length]; CFLibrary.CFDictionaryGetKeysAndValues(ptr, keys, values); Hashtable apps = new Hashtable(); for (int i = 0; i < length; i++) { CFDictionary dict = new CFDictionary(values[i]); string bundle = dict.GetValue(CFBundleIdentifier).ToString(); string type = dict.GetValue(ApplicationType).ToString(); string name = dict.GetValue(CFBundleName).ToString(); string displayname = dict.GetValue(CFBundleDisplayName).ToString(); string version = dict.GetValue(CFBundleShortVersionString).ToString(); string build = dict.GetValue(CFBundleVersion).ToString(); Hashtable app = new Hashtable(); app.Add(CFBundleIdentifier, bundle); app.Add(ApplicationType, type); app.Add(CFBundleName, name); app.Add(CFBundleDisplayName, displayname); app.Add(CFBundleShortVersionString, version); app.Add(CFBundleVersion, build); apps.Add(bundle, app); } return(apps); }
IntPtr Get(NSString key) { return(CFDictionary.GetValue(Dictionary.Handle, key.Handle)); }