// Token: 0x06000012 RID: 18 RVA: 0x0000248C File Offset: 0x0000068C private unsafe static string GetStringFromObject(void *obj) { int num = CFDictParser.CFStringGetLength(obj); CFDictParser.__CFRange range = default(CFDictParser.__CFRange); range.length = num; range.location = 0; char[] array = new char[num]; CFDictParser.CFStringGetCharacters(obj, range, Marshal.UnsafeAddrOfPinnedArrayElement(array, 0)); return(new string(array)); }
// Token: 0x06000014 RID: 20 RVA: 0x00002558 File Offset: 0x00000758 private unsafe static byte[] GetDataFromObject(void *obj) { int num = CFDictParser.CFDataGetLength(obj); byte[] array = new byte[num]; CFDictParser.CFDataGetBytes(obj, new CFDictParser.__CFRange { length = num, location = 0 }, Marshal.UnsafeAddrOfPinnedArrayElement(array, 0)); return(array); }
// Token: 0x06000010 RID: 16 RVA: 0x00002278 File Offset: 0x00000478 public unsafe static Dictionary <string, object> ParseAppDictionaryData(void *root_dict) { int num = CFDictParser.CFDictionaryGetCount(root_dict); Dictionary <string, object> dictionary = new Dictionary <string, object>(num); void *[] array = new void *[num]; void *[] values = new void *[num]; CFDictParser.CFDictionaryGetKeysAndValues(root_dict, array, values); for (int i = 0; i < num; i++) { CFDictParser.CFType cFType = CFDictParser.CFGetTypeID(array[i]); if (cFType != CFDictParser.CFType.CFString) { throw new Exception("Key not string type"); } string stringFromObject = CFDictParser.GetStringFromObject(array[i]); List <string> list = new List <string>(); list.Add("CFBundleDisplayName"); list.Add("CFBundleName"); list.Add("CFBundleIconFiles"); list.Add("UIPrerenderedIcon"); list.Add("ApplicationType"); list.Add("UIFileSharingEnabled"); list.Add("SignerIdentity"); void * dict = CFDictParser.CFDictionaryGetValue(root_dict, array[i]); int num2 = CFDictParser.CFDictionaryGetCount(dict); void *[] array2 = new void *[num2]; void *[] values2 = new void *[num2]; CFDictParser.CFDictionaryGetKeysAndValues(dict, array2, values2); Dictionary <string, object> dictionary2 = new Dictionary <string, object>(num2); for (int j = 0; j < num2; j++) { CFDictParser.CFType cFType2 = CFDictParser.CFGetTypeID(array2[j]); if (cFType2 != CFDictParser.CFType.CFString) { throw new Exception("Key not string type"); } string stringFromObject2 = CFDictParser.GetStringFromObject(array2[j]); if (list.Contains(stringFromObject2)) { dictionary2.Add(stringFromObject2, CFDictParser.ParseObject(CFDictParser.CFDictionaryGetValue(dict, array2[j]), stringFromObject2)); } } dictionary.Add(stringFromObject, dictionary2); } return(dictionary); }
// Token: 0x06000015 RID: 21 RVA: 0x0000259C File Offset: 0x0000079C private unsafe static object GetNumberFromObject(void *obj) { CFDictParser.CFNumberType cFNumberType = CFDictParser.CFNumberGetType(obj); IntPtr intPtr = Marshal.AllocHGlobal(8); CFDictParser.CFNumberGetValue(obj, cFNumberType, intPtr); byte[] array = new byte[8]; Marshal.Copy(intPtr, array, 0, 8); Marshal.FreeHGlobal(intPtr); switch (cFNumberType) { case CFDictParser.CFNumberType.kCFNumberSInt16Type: { object result = BitConverter.ToInt16(array, 0); return(result); } case CFDictParser.CFNumberType.kCFNumberSInt32Type: case CFDictParser.CFNumberType.kCFNumberIntType: { object result = BitConverter.ToInt32(array, 0); return(result); } case CFDictParser.CFNumberType.kCFNumberSInt64Type: { object result = BitConverter.ToInt64(array, 0); return(result); } case CFDictParser.CFNumberType.kCFNumberFloat32Type: case CFDictParser.CFNumberType.kCFNumberFloatType: { object result = BitConverter.ToSingle(array, 0); return(result); } case CFDictParser.CFNumberType.kCFNumberFloat64Type: case CFDictParser.CFNumberType.kCFNumberDoubleType: { object result = BitConverter.ToDouble(array, 0); return(result); } } throw new Exception("CFNumberType not implemented: " + cFNumberType.ToString()); }
// Token: 0x06000013 RID: 19 RVA: 0x000024D8 File Offset: 0x000006D8 private unsafe static Array GetArrayFromObject(void *obj) { int num = CFDictParser.CFArrayGetCount(obj); object[] array = new object[num]; void *[] array2 = new void *[num]; CFDictParser.__CFRange _CFRange = default(CFDictParser.__CFRange); _CFRange.length = num; _CFRange.location = 0; for (int i = 0; i < num; i++) { array2[i] = CFDictParser.CFArrayGetValueAtIndex(obj, i); } for (int i = 0; i < num; i++) { array[i] = CFDictParser.ParseObject(array2[i], null); } return(array); }
// Token: 0x06000011 RID: 17 RVA: 0x000023FC File Offset: 0x000005FC public unsafe static Dictionary <string, object> Parse(void *root_dict) { int num = CFDictParser.CFDictionaryGetCount(root_dict); Dictionary <string, object> dictionary = new Dictionary <string, object>(num); void *[] array = new void *[num]; void *[] values = new void *[num]; CFDictParser.CFDictionaryGetKeysAndValues(root_dict, array, values); for (int i = 0; i < num; i++) { CFDictParser.CFType cFType = CFDictParser.CFGetTypeID(array[i]); if (cFType != CFDictParser.CFType.CFString) { throw new Exception("Key not string type"); } string stringFromObject = CFDictParser.GetStringFromObject(array[i]); void * obj = CFDictParser.CFDictionaryGetValue(root_dict, array[i]); dictionary.Add(stringFromObject, CFDictParser.ParseObject(obj, stringFromObject)); } return(dictionary); }
// Token: 0x06000016 RID: 22 RVA: 0x00002680 File Offset: 0x00000880 private unsafe static object ParseObject(void *obj, string keyname) { CFDictParser.CFType cFType = CFDictParser.CFGetTypeID(obj); CFDictParser.CFType cFType2 = cFType; object result; if (cFType2 != CFDictParser.CFType.CFString) { switch (cFType2) { case CFDictParser.CFType.CFDictionary: result = CFDictParser.Parse(obj); return(result); case CFDictParser.CFType.CFArray: case CFDictParser.CFType.CFBundleIconFiles: result = CFDictParser.GetArrayFromObject(obj); return(result); case CFDictParser.CFType.CFBoolean: result = CFDictParser.CFBooleanGetValue(obj); return(result); case CFDictParser.CFType.CFNumber: result = CFDictParser.GetNumberFromObject(obj); return(result); case CFDictParser.CFType.CFData: result = CFDictParser.GetDataFromObject(obj); return(result); } result = CFDictParser.GetDataFromObject(obj); } else { result = CFDictParser.GetStringFromObject(obj); } return(result); }
private unsafe static extern void CFStringGetCharacters(void* obj, CFDictParser.__CFRange range, IntPtr buffer);
private unsafe static extern bool CFNumberGetValue(void* obj, CFDictParser.CFNumberType theType, IntPtr valuePtr);
private unsafe static extern void CFDataGetBytes(void* obj, CFDictParser.__CFRange range, IntPtr buffer);
private unsafe static extern void CFArrayGetValues(void* array, CFDictParser.__CFRange range, void*[] values);