Ejemplo n.º 1
0
        // Token: 0x060001F3 RID: 499 RVA: 0x00007FB4 File Offset: 0x000061B4
        private static byte[] writeBinaryString(string value, bool head)
        {
            List <byte> list  = new List <byte>();
            List <byte> list2 = new List <byte>();

            foreach (char value2 in value.ToCharArray())
            {
                list.Add(Convert.ToByte(value2));
            }
            if (head)
            {
                if (value.Length < 15)
                {
                    list2.Add(Convert.ToByte((int)(80 | Convert.ToByte(value.Length))));
                }
                else
                {
                    list2.Add(95);
                    list2.AddRange(Plist.writeBinaryInteger(list.Count, false));
                }
            }
            list.InsertRange(0, list2);
            Plist.objectTable.InsertRange(0, list);
            return(list.ToArray());
        }
Ejemplo n.º 2
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());
            }
        }
Ejemplo n.º 3
0
        // Token: 0x060001ED RID: 493 RVA: 0x00007BFC File Offset: 0x00005DFC
        private static byte[] composeBinary(object obj)
        {
            string left = obj.GetType().ToString();

            byte[] result;
            if (Operators.CompareString(left, "System.Collections.Generic.Dictionary`2[System.String,System.Object]", false) == 0)
            {
                byte[] array = Plist.writeBinaryDictionary((Dictionary <string, object>)obj);
                result = array;
            }
            else if (Operators.CompareString(left, "System.Collections.Generic.List`1[System.Object]", false) == 0)
            {
                byte[] array = Plist.composeBinaryArray((List <object>)obj);
                result = array;
            }
            else if (Operators.CompareString(left, "System.Byte[]", false) == 0)
            {
                byte[] array = Plist.writeBinaryByteArray((byte[])obj);
                result = array;
            }
            else if (Operators.CompareString(left, "System.Double", false) == 0)
            {
                byte[] array = Plist.writeBinaryDouble((double)obj);
                result = array;
            }
            else if (Operators.CompareString(left, "System.Int32", false) == 0)
            {
                byte[] array = Plist.writeBinaryInteger((int)obj, true);
                result = array;
            }
            else if (Operators.CompareString(left, "System.String", false) == 0)
            {
                byte[] array = Plist.writeBinaryString((string)obj, true);
                result = array;
            }
            else if (Operators.CompareString(left, "System.DateTime", false) == 0)
            {
                byte[] array = Plist.writeBinaryDate((DateTime)obj);
                result = array;
            }
            else if (Operators.CompareString(left, "System.Boolean", false) == 0)
            {
                byte[] array = Plist.writeBinaryBool((bool)obj);
                result = array;
            }
            else
            {
                result = new byte[0];
            }
            return(result);
        }
Ejemplo n.º 4
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());
            }
        }
Ejemplo n.º 5
0
        // Token: 0x060001F2 RID: 498 RVA: 0x00007F40 File Offset: 0x00006140
        private static byte[] writeBinaryByteArray(byte[] value)
        {
            List <byte> list  = new List <byte>(value);
            List <byte> list2 = new List <byte>();

            if (value.Length < 15)
            {
                list2.Add(Convert.ToByte((int)(64 | Convert.ToByte(value.Length))));
            }
            else
            {
                list2.Add(79);
                list2.AddRange(Plist.writeBinaryInteger(list.Count, false));
            }
            list.InsertRange(0, list2);
            Plist.objectTable.InsertRange(0, list);
            return(list.ToArray());
        }