private static writeBinaryString ( string value, bool head ) : byte[] | ||
value | string | |
head | bool | |
return | byte[] |
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 byte[] composeBinary(object obj) { string s = obj.GetType().ToString(); // ISSUE: reference to a compiler-generated method uint stringHash = (uint.Parse(s)); if (stringHash <= 1541528931U) { if (stringHash <= 848225627U) { if ((int)stringHash != 347085918) { if ((int)stringHash == 848225627 && s == "System.Double") { return(Plist.writeBinaryDouble((double)obj)); } } else if (s == "System.Boolean") { return(Plist.writeBinaryBool((bool)obj)); } } else if ((int)stringHash != 1461188995) { if ((int)stringHash == 1541528931 && s == "System.DateTime") { return(Plist.writeBinaryDate((DateTime)obj)); } } else if (s == "System.Collections.Generic.List`1[System.Object]") { return(Plist.composeBinaryArray((List <object>)obj)); } } else if (stringHash <= 4180476474U) { if ((int)stringHash != -1520294252) { if ((int)stringHash == -114490822 && s == "System.Int32") { return(Plist.writeBinaryInteger((int)obj, true)); } } else if (s == "System.Collections.Generic.Dictionary`2[System.String,System.Object]") { return(Plist.writeBinaryDictionary((Dictionary <string, object>)obj)); } } else if ((int)stringHash != -93602905) { if ((int)stringHash == -38277272 && s == "System.Byte[]") { return(Plist.writeBinaryByteArray((byte[])obj)); } } else if (s == "System.String") { return(Plist.writeBinaryString((string)obj, true)); } return(new byte[0]); }
// Token: 0x06000117 RID: 279 RVA: 0x000078C8 File Offset: 0x00005AC8 private static byte[] composeBinary(object obj) { string text = obj.GetType().ToString(); byte[] result; switch (text) { case "System.Collections.Generic.Dictionary`2[System.String,System.Object]": { byte[] array = Plist.writeBinaryDictionary((Dictionary <string, object>)obj); result = array; return(result); } case "System.Collections.Generic.List`1[System.Object]": { byte[] array = Plist.composeBinaryArray((List <object>)obj); result = array; return(result); } case "System.Byte[]": { byte[] array = Plist.writeBinaryByteArray((byte[])obj); result = array; return(result); } case "System.Double": { byte[] array = Plist.writeBinaryDouble((double)obj); result = array; return(result); } case "System.Int32": { byte[] array = Plist.writeBinaryInteger((int)obj, true); result = array; return(result); } case "System.String": { byte[] array = Plist.writeBinaryString((string)obj, true); result = array; return(result); } case "System.DateTime": { byte[] array = Plist.writeBinaryDate((DateTime)obj); result = array; return(result); } case "System.Boolean": { byte[] array = Plist.writeBinaryBool((bool)obj); result = array; return(result); } } result = new byte[0]; return(result); }