private static IDictionary DeserializeData(byte[] data)
        {
            IDictionary dictionary = null;

            if ((data != null) && (data.Length > 0))
            {
                Exception innerException = null;
                int       num            = -1;
                object[]  objArray       = null;
                int       num2           = 0;
                try
                {
                    ObjectStateFormatter formatter = new ObjectStateFormatter(null, false);
                    if ((!HttpRuntime.DisableProcessRequestInApplicationTrust && (HttpRuntime.NamedPermissionSet != null)) && HttpRuntime.ProcessRequestInApplicationTrust)
                    {
                        HttpRuntime.NamedPermissionSet.PermitOnly();
                    }
                    objArray = (object[])formatter.DeserializeWithAssert(new MemoryStream(data));
                    if ((objArray != null) && (objArray.Length != 0))
                    {
                        num = (int)objArray[num2++];
                    }
                }
                catch (Exception exception2)
                {
                    innerException = exception2;
                }
                switch (num)
                {
                case 1:
                case 2:
                    try
                    {
                        int initialSize = (int)objArray[num2++];
                        if (initialSize > 0)
                        {
                            dictionary = new HybridDictionary(initialSize, false);
                        }
                        for (int i = 0; i < initialSize; i++)
                        {
                            string      str;
                            bool        flag;
                            Type        type = null;
                            VirtualPath path = null;
                            object      obj2 = objArray[num2++];
                            if (obj2 is string)
                            {
                                str  = (string)obj2;
                                flag = false;
                            }
                            else
                            {
                                type = (Type)obj2;
                                if (type == typeof(UserControl))
                                {
                                    path = VirtualPath.CreateNonRelativeAllowNull((string)objArray[num2++]);
                                }
                                str  = (string)objArray[num2++];
                                flag = true;
                            }
                            IDictionary dictionary2 = null;
                            int         num5        = (int)objArray[num2++];
                            if (num5 > 0)
                            {
                                dictionary2 = new HybridDictionary(num5, false);
                                for (int j = 0; j < num5; j++)
                                {
                                    string str2 = ((IndexedString)objArray[num2++]).Value;
                                    object obj3 = objArray[num2++];
                                    dictionary2[str2] = obj3;
                                }
                            }
                            PersonalizationDictionary dictionary3 = null;
                            int num7 = (int)objArray[num2++];
                            if (num7 > 0)
                            {
                                dictionary3 = new PersonalizationDictionary(num7);
                                for (int k = 0; k < num7; k++)
                                {
                                    string str3 = ((IndexedString)objArray[num2++]).Value;
                                    object obj4 = objArray[num2++];
                                    System.Web.UI.WebControls.WebParts.PersonalizationScope scope = ((bool)objArray[num2++]) ? System.Web.UI.WebControls.WebParts.PersonalizationScope.Shared : System.Web.UI.WebControls.WebParts.PersonalizationScope.User;
                                    bool isSensitive = false;
                                    if (num == 2)
                                    {
                                        isSensitive = (bool)objArray[num2++];
                                    }
                                    dictionary3[str3] = new PersonalizationEntry(obj4, scope, isSensitive);
                                }
                            }
                            PersonalizationInfo info = new PersonalizationInfo {
                                _controlID        = str,
                                _controlType      = type,
                                _controlVPath     = path,
                                _isStatic         = flag,
                                _properties       = dictionary2,
                                _customProperties = dictionary3
                            };
                            dictionary[str] = info;
                        }
                    }
                    catch (Exception exception3)
                    {
                        innerException = exception3;
                    }
                    break;
                }
                if ((innerException != null) || ((num != 1) && (num != 2)))
                {
                    throw new ArgumentException(System.Web.SR.GetString("BlobPersonalizationState_DeserializeError"), "data", innerException);
                }
            }
            if (dictionary == null)
            {
                dictionary = new HybridDictionary(false);
            }
            return(dictionary);
        }