private static object readBinary(byte[] data) { Plist.offsetTable.Clear(); List <byte> nums = new List <byte>(); Plist.objectTable.Clear(); Plist.refCount = 0; Plist.objRefSize = 0; Plist.offsetByteSize = 0; Plist.offsetTableOffset = (long)0; List <byte> nums1 = new List <byte>(data); Plist.parseTrailer(nums1.GetRange(nums1.Count - 32, 32)); Plist.objectTable = nums1.GetRange(0, (int)Plist.offsetTableOffset); Plist.parseOffsetTable(nums1.GetRange((int)Plist.offsetTableOffset, nums1.Count - (int)Plist.offsetTableOffset - 32)); return(Plist.parseBinary(0)); }
private static object parseBinaryDictionary(int objRef) { int num; Dictionary <string, object> strs = new Dictionary <string, object>(); List <int> nums = new List <int>(); int count = 0; count = Plist.getCount(Plist.offsetTable[objRef], out num); num = (count >= 15 ? Plist.offsetTable[objRef] + 2 + (int)Plist.RegulateNullBytes(BitConverter.GetBytes(count), 1).Length : Plist.offsetTable[objRef] + 1); for (int i = num; i < num + count * 2 * Plist.objRefSize; i += Plist.objRefSize) { byte[] array = Plist.objectTable.GetRange(i, Plist.objRefSize).ToArray(); Array.Reverse(array); nums.Add(BitConverter.ToInt32(Plist.RegulateNullBytes(array, 4), 0)); } for (int j = 0; j < count; j++) { strs.Add((string)Plist.parseBinary(nums[j]), Plist.parseBinary(nums[j + count])); } return(strs); }