private static RegulateNullBytes ( byte value ) : byte[] | ||
value | byte | |
return | byte[] |
// Token: 0x06000122 RID: 290 RVA: 0x00007EC0 File Offset: 0x000060C0 private static object parseBinaryDictionary(int objRef) { Dictionary <string, object> dictionary = new Dictionary <string, object>(); List <int> list = new List <int>(); int num; int count = Plist.getCount(Plist.offsetTable[objRef], out num); if (count < 15) { num = Plist.offsetTable[objRef] + 1; } else { num = Plist.offsetTable[objRef] + 2 + Plist.RegulateNullBytes(BitConverter.GetBytes(count), 1).Length; } 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); list.Add(BitConverter.ToInt32(Plist.RegulateNullBytes(array, 4), 0)); } for (int i = 0; i < count; i++) { dictionary.Add((string)Plist.parseBinary(list[i]), Plist.parseBinary(list[i + count])); } return(dictionary); }
private static byte[] composeBinaryArray(List <object> objects) { List <byte> byteList1 = new List <byte>(); List <byte> byteList2 = new List <byte>(); List <int> intList = new List <int>(); for (int index = objects.Count - 1; index >= 0; --index) { Plist.composeBinary(objects[index]); Plist.offsetTable.Add(Plist.objectTable.Count); intList.Add(Plist.refCount); --Plist.refCount; } if (objects.Count < 15) { byteList2.Add(Convert.ToByte(160 | (int)Convert.ToByte(objects.Count))); } else { byteList2.Add((byte)175); byteList2.AddRange((IEnumerable <byte>)Plist.writeBinaryInteger(objects.Count, false)); } foreach (int num in intList) { byte[] numArray = Plist.RegulateNullBytes(BitConverter.GetBytes(num), Plist.objRefSize); Array.Reverse((Array)numArray); byteList1.InsertRange(0, (IEnumerable <byte>)numArray); } byteList1.InsertRange(0, (IEnumerable <byte>)byteList2); Plist.objectTable.InsertRange(0, (IEnumerable <byte>)byteList1); return(byteList1.ToArray()); }
// Token: 0x06000116 RID: 278 RVA: 0x00007790 File Offset: 0x00005990 private static byte[] composeBinaryArray(List <object> objects) { List <byte> list = new List <byte>(); List <byte> list2 = new List <byte>(); List <int> list3 = new List <int>(); for (int i = objects.Count - 1; i >= 0; i--) { Plist.composeBinary(objects[i]); Plist.offsetTable.Add(Plist.objectTable.Count); list3.Add(Plist.refCount); Plist.refCount--; } if (objects.Count < 15) { list2.Add(Convert.ToByte((int)(160 | Convert.ToByte(objects.Count)))); } else { list2.Add(175); list2.AddRange(Plist.writeBinaryInteger(objects.Count, false)); } foreach (int current in list3) { byte[] array = Plist.RegulateNullBytes(BitConverter.GetBytes(current), Plist.objRefSize); Array.Reverse(array); list.InsertRange(0, array); } list.InsertRange(0, list2); Plist.objectTable.InsertRange(0, list); return(list.ToArray()); }
public static byte[] writeBinaryDate(DateTime obj) { List <byte> byteList = new List <byte>((IEnumerable <byte>)Plist.RegulateNullBytes(BitConverter.GetBytes(PlistDateConverter.ConvertToAppleTimeStamp(obj)), 8)); byteList.Reverse(); byteList.Insert(0, (byte)51); Plist.objectTable.InsertRange(0, (IEnumerable <byte>)byteList); return(byteList.ToArray()); }
// Token: 0x06000121 RID: 289 RVA: 0x00007E6C File Offset: 0x0000606C private static void parseOffsetTable(List <byte> offsetTableBytes) { for (int i = 0; i < offsetTableBytes.Count; i += Plist.offsetByteSize) { byte[] array = offsetTableBytes.GetRange(i, Plist.offsetByteSize).ToArray(); Array.Reverse(array); Plist.offsetTable.Add(BitConverter.ToInt32(Plist.RegulateNullBytes(array, 4), 0)); } }
// Token: 0x06000129 RID: 297 RVA: 0x000082EC File Offset: 0x000064EC private static object parseBinaryReal(int headerPosition) { byte b = Plist.objectTable[headerPosition]; int count = (int)Math.Pow(2.0, (double)(b & 15)); byte[] array = Plist.objectTable.GetRange(headerPosition + 1, count).ToArray(); Array.Reverse(array); return(BitConverter.ToDouble(Plist.RegulateNullBytes(array, 8), 0)); }
// Token: 0x06000128 RID: 296 RVA: 0x00008288 File Offset: 0x00006488 private static object parseBinaryInt(int headerPosition, out int newHeaderPosition) { byte b = Plist.objectTable[headerPosition]; int num = (int)Math.Pow(2.0, (double)(b & 15)); byte[] array = Plist.objectTable.GetRange(headerPosition + 1, num).ToArray(); Array.Reverse(array); newHeaderPosition = headerPosition + num + 1; return(BitConverter.ToInt32(Plist.RegulateNullBytes(array, 4), 0)); }
private static object parseBinaryReal(int headerPosition) { int count = (int)Math.Pow(2.0, (double)((int)Plist.objectTable[headerPosition] & 15)); byte[] array = Plist.objectTable.GetRange(headerPosition + 1, count).ToArray(); Array.Reverse((Array)array); int minBytes = 8; return((object)BitConverter.ToDouble(Plist.RegulateNullBytes(array, minBytes), 0)); }
// Token: 0x06000120 RID: 288 RVA: 0x00007DE0 File Offset: 0x00005FE0 private static void parseTrailer(List <byte> trailer) { Plist.offsetByteSize = BitConverter.ToInt32(Plist.RegulateNullBytes(trailer.GetRange(6, 1).ToArray(), 4), 0); Plist.objRefSize = BitConverter.ToInt32(Plist.RegulateNullBytes(trailer.GetRange(7, 1).ToArray(), 4), 0); byte[] array = trailer.GetRange(12, 4).ToArray(); Array.Reverse(array); Plist.refCount = BitConverter.ToInt32(array, 0); byte[] array2 = trailer.GetRange(24, 8).ToArray(); Array.Reverse(array2); Plist.offsetTableOffset = BitConverter.ToInt64(array2, 0); }
private static void parseOffsetTable(List <byte> offsetTableBytes) { int index = 0; while (index < offsetTableBytes.Count) { byte[] array = offsetTableBytes.GetRange(index, Plist.offsetByteSize).ToArray(); Array.Reverse((Array)array); Plist.offsetTable.Add(BitConverter.ToInt32(Plist.RegulateNullBytes(array, 4), 0)); index += Plist.offsetByteSize; } }
private static byte[] writeBinaryDouble(double value) { List <byte> byteList = new List <byte>((IEnumerable <byte>)Plist.RegulateNullBytes(BitConverter.GetBytes(value), 4)); while ((double)byteList.Count != Math.Pow(2.0, Math.Log((double)byteList.Count) / Math.Log(2.0))) { byteList.Add((byte)0); } int num = 32 | (int)(Math.Log((double)byteList.Count) / Math.Log(2.0)); byteList.Reverse(); byteList.Insert(0, Convert.ToByte(num)); Plist.objectTable.InsertRange(0, (IEnumerable <byte>)byteList); return(byteList.ToArray()); }
// Token: 0x0600011B RID: 283 RVA: 0x00007B64 File Offset: 0x00005D64 private static byte[] writeBinaryDouble(double value) { List <byte> list = new List <byte>(Plist.RegulateNullBytes(BitConverter.GetBytes(value), 4)); while ((double)list.Count != Math.Pow(2.0, Math.Log((double)list.Count) / Math.Log(2.0))) { list.Add(0); } int value2 = 32 | (int)(Math.Log((double)list.Count) / Math.Log(2.0)); list.Reverse(); list.Insert(0, Convert.ToByte(value2)); Plist.objectTable.InsertRange(0, list); return(list.ToArray()); }
private static byte[] writeBinaryInteger(int value, bool write) { List <byte> byteList = new List <byte>((IEnumerable <byte>)Plist.RegulateNullBytes(new List <byte>((IEnumerable <byte>)BitConverter.GetBytes((long)value)).ToArray())); while ((double)byteList.Count != Math.Pow(2.0, Math.Log((double)byteList.Count) / Math.Log(2.0))) { byteList.Add((byte)0); } int num = 16 | (int)(Math.Log((double)byteList.Count) / Math.Log(2.0)); byteList.Reverse(); byteList.Insert(0, Convert.ToByte(num)); if (write) { Plist.objectTable.InsertRange(0, (IEnumerable <byte>)byteList); } return(byteList.ToArray()); }
private static byte[] writeBinaryDictionary(Dictionary <string, object> dictionary) { List <byte> byteList1 = new List <byte>(); List <byte> byteList2 = new List <byte>(); List <int> intList = new List <int>(); for (int index = dictionary.Count - 1; index >= 0; --index) { object[] array = new object[dictionary.Count]; dictionary.Values.CopyTo(array, 0); Plist.composeBinary(array[index]); Plist.offsetTable.Add(Plist.objectTable.Count); intList.Add(Plist.refCount); --Plist.refCount; } for (int index = dictionary.Count - 1; index >= 0; --index) { string[] array = new string[dictionary.Count]; dictionary.Keys.CopyTo(array, 0); Plist.composeBinary((object)array[index]); Plist.offsetTable.Add(Plist.objectTable.Count); intList.Add(Plist.refCount); --Plist.refCount; } if (dictionary.Count < 15) { byteList2.Add(Convert.ToByte(208 | (int)Convert.ToByte(dictionary.Count))); } else { byteList2.Add((byte)223); byteList2.AddRange((IEnumerable <byte>)Plist.writeBinaryInteger(dictionary.Count, false)); } foreach (int num in intList) { byte[] numArray = Plist.RegulateNullBytes(BitConverter.GetBytes(num), Plist.objRefSize); Array.Reverse((Array)numArray); byteList1.InsertRange(0, (IEnumerable <byte>)numArray); } byteList1.InsertRange(0, (IEnumerable <byte>)byteList2); Plist.objectTable.InsertRange(0, (IEnumerable <byte>)byteList1); return(byteList1.ToArray()); }
// Token: 0x06000115 RID: 277 RVA: 0x000075D8 File Offset: 0x000057D8 private static byte[] writeBinaryDictionary(Dictionary <string, object> dictionary) { List <byte> list = new List <byte>(); List <byte> list2 = new List <byte>(); List <int> list3 = new List <int>(); for (int i = dictionary.Count - 1; i >= 0; i--) { object[] array = new object[dictionary.Count]; dictionary.Values.CopyTo(array, 0); Plist.composeBinary(array[i]); Plist.offsetTable.Add(Plist.objectTable.Count); list3.Add(Plist.refCount); Plist.refCount--; } for (int i = dictionary.Count - 1; i >= 0; i--) { string[] array2 = new string[dictionary.Count]; dictionary.Keys.CopyTo(array2, 0); Plist.composeBinary(array2[i]); Plist.offsetTable.Add(Plist.objectTable.Count); list3.Add(Plist.refCount); Plist.refCount--; } if (dictionary.Count < 15) { list2.Add(Convert.ToByte((int)(208 | Convert.ToByte(dictionary.Count)))); } else { list2.Add(223); list2.AddRange(Plist.writeBinaryInteger(dictionary.Count, false)); } foreach (int current in list3) { byte[] array3 = Plist.RegulateNullBytes(BitConverter.GetBytes(current), Plist.objRefSize); Array.Reverse(array3); list.InsertRange(0, array3); } list.InsertRange(0, list2); Plist.objectTable.InsertRange(0, list); return(list.ToArray()); }
// Token: 0x0600011A RID: 282 RVA: 0x00007AAC File Offset: 0x00005CAC private static byte[] writeBinaryInteger(int value, bool write) { List <byte> list = new List <byte>(BitConverter.GetBytes((long)value)); list = new List <byte>(Plist.RegulateNullBytes(list.ToArray())); while ((double)list.Count != Math.Pow(2.0, Math.Log((double)list.Count) / Math.Log(2.0))) { list.Add(0); } int value2 = 16 | (int)(Math.Log((double)list.Count) / Math.Log(2.0)); list.Reverse(); list.Insert(0, Convert.ToByte(value2)); if (write) { Plist.objectTable.InsertRange(0, list); } return(list.ToArray()); }
public static byte[] writeBinary(object value) { Plist.offsetTable.Clear(); Plist.objectTable.Clear(); Plist.refCount = 0; Plist.objRefSize = 0; Plist.offsetByteSize = 0; Plist.offsetTableOffset = 0L; int num = Plist.countObject(value) - 1; Plist.refCount = num; Plist.objRefSize = Plist.RegulateNullBytes(BitConverter.GetBytes(Plist.refCount)).Length; Plist.composeBinary(value); Plist.writeBinaryString("bplist00", false); Plist.offsetTableOffset = (long)Plist.objectTable.Count; Plist.offsetTable.Add(Plist.objectTable.Count - 8); Plist.offsetByteSize = Plist.RegulateNullBytes(BitConverter.GetBytes(Plist.offsetTable[Plist.offsetTable.Count - 1])).Length; List <byte> byteList = new List <byte>(); Plist.offsetTable.Reverse(); for (int index = 0; index < Plist.offsetTable.Count; ++index) { Plist.offsetTable[index] = Plist.objectTable.Count - Plist.offsetTable[index]; byte[] numArray = Plist.RegulateNullBytes(BitConverter.GetBytes(Plist.offsetTable[index]), Plist.offsetByteSize); Array.Reverse((Array)numArray); byteList.AddRange((IEnumerable <byte>)numArray); } Plist.objectTable.AddRange((IEnumerable <byte>)byteList); Plist.objectTable.AddRange((IEnumerable <byte>) new byte[6]); Plist.objectTable.Add(Convert.ToByte(Plist.offsetByteSize)); Plist.objectTable.Add(Convert.ToByte(Plist.objRefSize)); byte[] bytes1 = BitConverter.GetBytes((long)num + 1L); Array.Reverse((Array)bytes1); Plist.objectTable.AddRange((IEnumerable <byte>)bytes1); Plist.objectTable.AddRange((IEnumerable <byte>)BitConverter.GetBytes(0L)); byte[] bytes2 = BitConverter.GetBytes(Plist.offsetTableOffset); Array.Reverse((Array)bytes2); Plist.objectTable.AddRange((IEnumerable <byte>)bytes2); return(Plist.objectTable.ToArray()); }
// Token: 0x0600010B RID: 267 RVA: 0x00006C84 File Offset: 0x00004E84 public static byte[] writeBinary(object value) { Plist.offsetTable.Clear(); Plist.objectTable.Clear(); Plist.refCount = 0; Plist.objRefSize = 0; Plist.offsetByteSize = 0; Plist.offsetTableOffset = 0L; int num = Plist.countObject(value) - 1; Plist.refCount = num; Plist.objRefSize = Plist.RegulateNullBytes(BitConverter.GetBytes(Plist.refCount)).Length; Plist.composeBinary(value); Plist.writeBinaryString("bplist00", false); Plist.offsetTableOffset = (long)Plist.objectTable.Count; Plist.offsetTable.Add(Plist.objectTable.Count - 8); Plist.offsetByteSize = Plist.RegulateNullBytes(BitConverter.GetBytes(Plist.offsetTable[Plist.offsetTable.Count - 1])).Length; List <byte> list = new List <byte>(); Plist.offsetTable.Reverse(); for (int i = 0; i < Plist.offsetTable.Count; i++) { Plist.offsetTable[i] = Plist.objectTable.Count - Plist.offsetTable[i]; byte[] array = Plist.RegulateNullBytes(BitConverter.GetBytes(Plist.offsetTable[i]), Plist.offsetByteSize); Array.Reverse(array); list.AddRange(array); } Plist.objectTable.AddRange(list); Plist.objectTable.AddRange(new byte[6]); Plist.objectTable.Add(Convert.ToByte(Plist.offsetByteSize)); Plist.objectTable.Add(Convert.ToByte(Plist.objRefSize)); byte[] bytes = BitConverter.GetBytes((long)num + 1L); Array.Reverse(bytes); Plist.objectTable.AddRange(bytes); Plist.objectTable.AddRange(BitConverter.GetBytes(0L)); bytes = BitConverter.GetBytes(Plist.offsetTableOffset); Array.Reverse(bytes); Plist.objectTable.AddRange(bytes); return(Plist.objectTable.ToArray()); }
private static object parseBinaryArray(int objRef) { List <object> objectList = new List <object>(); List <int> intList = new List <int>(); int num1 = (int)Plist.objectTable[Plist.offsetTable[objRef]]; int newBytePosition; int count = Plist.getCount(Plist.offsetTable[objRef], out newBytePosition); int num2 = count >= 15 ? Plist.offsetTable[objRef] + 2 + Plist.RegulateNullBytes(BitConverter.GetBytes(count), 1).Length : Plist.offsetTable[objRef] + 1; int index1 = num2; while (index1 < num2 + count * Plist.objRefSize) { byte[] array = Plist.objectTable.GetRange(index1, Plist.objRefSize).ToArray(); Array.Reverse((Array)array); intList.Add(BitConverter.ToInt32(Plist.RegulateNullBytes(array, 4), 0)); index1 += Plist.objRefSize; } for (int index2 = 0; index2 < count; ++index2) { objectList.Add(Plist.parseBinary(intList[index2])); } return((object)objectList); }
private static byte[] RegulateNullBytes(byte[] value) { return(Plist.RegulateNullBytes(value, 1)); }