Esempio n. 1
0
        // Token: 0x060001EB RID: 491 RVA: 0x000078D0 File Offset: 0x00005AD0
        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>();

            checked
            {
                int i = dictionary.Count - 1;
                while (i >= 0)
                {
                    object[] array = new object[dictionary.Count + 1];
                    dictionary.Values.CopyTo(array, 0);
                    Plist.composeBinary(RuntimeHelpers.GetObjectValue(array[i]));
                    Plist.offsetTable.Add(Plist.objectTable.Count);
                    list3.Add(Plist.refCount);
                    Math.Max(Interlocked.Decrement(ref Plist.refCount), Plist.refCount + 1);
                    Math.Max(Interlocked.Decrement(ref i), i + 1);
                }
                i = dictionary.Count - 1;
                while (i >= 0)
                {
                    string[] array2 = new string[dictionary.Count + 1];
                    dictionary.Keys.CopyTo(array2, 0);
                    Plist.composeBinary(array2[i]);
                    Plist.offsetTable.Add(Plist.objectTable.Count);
                    list3.Add(Plist.refCount);
                    Math.Max(Interlocked.Decrement(ref Plist.refCount), Plist.refCount + 1);
                    Math.Max(Interlocked.Decrement(ref i), i + 1);
                }
                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));
                }
                try
                {
                    foreach (int value in list3)
                    {
                        byte[] array3 = Plist.RegulateNullBytes(BitConverter.GetBytes(value), Plist.objRefSize);
                        Array.Reverse(array3);
                        list.InsertRange(0, array3);
                    }
                }
                finally
                {
                    List <int> .Enumerator enumerator;
                    ((IDisposable)enumerator).Dispose();
                }
                list.InsertRange(0, list2);
                Plist.objectTable.InsertRange(0, list);
                return(list.ToArray());
            }
        }
Esempio n. 2
0
        // Token: 0x060001EC RID: 492 RVA: 0x00007AB0 File Offset: 0x00005CB0
        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>();

            checked
            {
                int i = objects.Count - 1;
                while (i >= 0)
                {
                    Plist.composeBinary(RuntimeHelpers.GetObjectValue(objects[i]));
                    Plist.offsetTable.Add(Plist.objectTable.Count);
                    list3.Add(Plist.refCount);
                    Math.Max(Interlocked.Decrement(ref Plist.refCount), Plist.refCount + 1);
                    Math.Max(Interlocked.Decrement(ref i), i + 1);
                }
                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));
                }
                try
                {
                    foreach (int value in list3)
                    {
                        byte[] array = Plist.RegulateNullBytes(BitConverter.GetBytes(value), Plist.objRefSize);
                        Array.Reverse(array);
                        list.InsertRange(0, array);
                    }
                }
                finally
                {
                    List <int> .Enumerator enumerator;
                    ((IDisposable)enumerator).Dispose();
                }
                list.InsertRange(0, list2);
                Plist.objectTable.InsertRange(0, list);
                return(list.ToArray());
            }
        }
Esempio n. 3
0
        // Token: 0x060001E1 RID: 481 RVA: 0x00006F74 File Offset: 0x00005174
        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 = checked (Plist.countObject(RuntimeHelpers.GetObjectValue(value)) - 1);

            Plist.refCount   = num;
            Plist.objRefSize = Plist.RegulateNullBytes(BitConverter.GetBytes(Plist.refCount)).Length;
            Plist.composeBinary(RuntimeHelpers.GetObjectValue(value));
            Plist.writeBinaryString("bplist00", false);
            Plist.offsetTableOffset = (long)Plist.objectTable.Count;
            checked
            {
                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();
                int i = 0;
                while (i < Plist.offsetTable.Count)
                {
                    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);
                    Math.Max(Interlocked.Increment(ref i), i - 1);
                }
                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(unchecked ((long)num) + 1L);
                Array.Reverse(bytes);
                Plist.objectTable.AddRange(bytes);
                Plist.objectTable.AddRange(BitConverter.GetBytes(0));
                bytes = BitConverter.GetBytes(Plist.offsetTableOffset);
                Array.Reverse(bytes);
                Plist.objectTable.AddRange(bytes);
                return(Plist.objectTable.ToArray());
            }
        }