public override void FromXml (SecurityElement securityElement) {
            CodeAccessPermission.ValidateElement(securityElement, this);
            if (XMLUtil.IsUnrestricted(securityElement)) {
                m_flags = KeyContainerPermissionFlags.AllFlags;
                m_accessEntries = new KeyContainerPermissionAccessEntryCollection(m_flags);
                return;
            }

            m_flags = KeyContainerPermissionFlags.NoFlags;
            string strFlags = securityElement.Attribute("Flags");
            if (strFlags != null) {
                KeyContainerPermissionFlags flags = (KeyContainerPermissionFlags) Enum.Parse(typeof(KeyContainerPermissionFlags), strFlags);
                VerifyFlags(flags);
                m_flags = flags;
            }
            m_accessEntries = new KeyContainerPermissionAccessEntryCollection(m_flags);

            if (securityElement.InternalChildren != null && securityElement.InternalChildren.Count != 0) { 
                IEnumerator enumerator = securityElement.Children.GetEnumerator();
                while (enumerator.MoveNext()) {
                    SecurityElement current = (SecurityElement) enumerator.Current;
                    if (current != null) {
                        if (String.Equals(current.Tag, "AccessList"))
                            AddAccessEntries(current);
                    }
                }
            }
        }
Exemple #2
0
        public override void FromXml(SecurityElement esd)
        {
            CodeAccessPermission.ValidateElement(esd, this);
            if (XMLUtil.IsUnrestricted(esd))
            {
                SetUnrestricted(true);
                return;
            }

            m_windowFlag    = UIPermissionWindow.NoWindows;
            m_clipboardFlag = UIPermissionClipboard.NoClipboard;

            String window = esd.Attribute("Window");

            if (window != null)
            {
                m_windowFlag = (UIPermissionWindow)Enum.Parse(typeof(UIPermissionWindow), window);
            }

            String clipboard = esd.Attribute("Clipboard");

            if (clipboard != null)
            {
                m_clipboardFlag = (UIPermissionClipboard)Enum.Parse(typeof(UIPermissionClipboard), clipboard);
            }
        }
Exemple #3
0
        public override void FromXml(SecurityElement esd)
        {
            CodeAccessPermission.ValidateElement(esd, this);

            String et;

            if (XMLUtil.IsUnrestricted(esd))
            {
                m_unrestricted = true;
                return;
            }

            m_unrestricted = false;
            m_read         = null;
            m_write        = null;

            et = esd.Attribute("Read");
            if (et != null)
            {
                m_read = new EnvironmentStringExpressionSet(et);
            }

            et = esd.Attribute("Write");
            if (et != null)
            {
                m_write = new EnvironmentStringExpressionSet(et);
            }
        }
        /// <summary>Reconstructs a permission with a specified state from an XML encoding.</summary>
        /// <param name="securityElement">A <see cref="T:System.Security.SecurityElement" /> that contains the XML encoding used to reconstruct the permission. </param>
        /// <exception cref="T:System.ArgumentNullException">
        ///         <paramref name="securityElement" /> is <see langword="null" />. </exception>
        /// <exception cref="T:System.ArgumentException">
        ///         <paramref name="securityElement" /> is not a valid permission element.-or- The version number of <paramref name="securityElement" /> is not supported. </exception>
        // Token: 0x060026CA RID: 9930 RVA: 0x0008C94C File Offset: 0x0008AB4C
        public override void FromXml(SecurityElement securityElement)
        {
            CodeAccessPermission.ValidateElement(securityElement, this);
            if (XMLUtil.IsUnrestricted(securityElement))
            {
                this.m_flags         = KeyContainerPermissionFlags.AllFlags;
                this.m_accessEntries = new KeyContainerPermissionAccessEntryCollection(this.m_flags);
                return;
            }
            this.m_flags = KeyContainerPermissionFlags.NoFlags;
            string text = securityElement.Attribute("Flags");

            if (text != null)
            {
                KeyContainerPermissionFlags flags = (KeyContainerPermissionFlags)Enum.Parse(typeof(KeyContainerPermissionFlags), text);
                KeyContainerPermission.VerifyFlags(flags);
                this.m_flags = flags;
            }
            this.m_accessEntries = new KeyContainerPermissionAccessEntryCollection(this.m_flags);
            if (securityElement.InternalChildren != null && securityElement.InternalChildren.Count != 0)
            {
                foreach (object obj in securityElement.Children)
                {
                    SecurityElement securityElement2 = (SecurityElement)obj;
                    if (securityElement2 != null && string.Equals(securityElement2.Tag, "AccessList"))
                    {
                        this.AddAccessEntries(securityElement2);
                    }
                }
            }
        }
 public override void FromXml(SecurityElement esd)
 {
     CodeAccessPermission.ValidateElement(esd, this);
     this.m_allowed = IsolatedStorageContainment.None;
     if (XMLUtil.IsUnrestricted(esd))
     {
         this.m_allowed = IsolatedStorageContainment.UnrestrictedIsolatedStorage;
     }
     else
     {
         string str = esd.Attribute("Allowed");
         if (str != null)
         {
             this.m_allowed = (IsolatedStorageContainment)Enum.Parse(typeof(IsolatedStorageContainment), str);
         }
     }
     if (this.m_allowed == IsolatedStorageContainment.UnrestrictedIsolatedStorage)
     {
         this.m_userQuota      = 0x7fffffffffffffffL;
         this.m_machineQuota   = 0x7fffffffffffffffL;
         this.m_expirationDays = 0x7fffffffffffffffL;
         this.m_permanentData  = true;
     }
     else
     {
         string s = esd.Attribute("UserQuota");
         this.m_userQuota = (s != null) ? long.Parse(s, CultureInfo.InvariantCulture) : 0L;
         s = esd.Attribute("MachineQuota");
         this.m_machineQuota = (s != null) ? long.Parse(s, CultureInfo.InvariantCulture) : 0L;
         s = esd.Attribute("Expiry");
         this.m_expirationDays = (s != null) ? long.Parse(s, CultureInfo.InvariantCulture) : 0L;
         s = esd.Attribute("Permanent");
         this.m_permanentData = (s != null) ? bool.Parse(s) : false;
     }
 }
Exemple #6
0
 /// <summary>从 XML 编码重新构造具有指定状态的权限。</summary>
 /// <param name="esd">用于重新构造权限的 XML 编码。</param>
 /// <exception cref="T:System.ArgumentNullException">
 /// <paramref name="esd" /> 参数为 null。</exception>
 /// <exception cref="T:System.ArgumentException">
 /// <paramref name="esd" /> 参数不是有效的权限元素。- 或 -<paramref name="esd" /> 参数的版本号无效。</exception>
 public override void FromXml(SecurityElement esd)
 {
     CodeAccessPermission.ValidateElement(esd, (IPermission)this);
     if (XMLUtil.IsUnrestricted(esd))
     {
         this.m_unrestricted = true;
     }
     else
     {
         this.m_unrestricted = false;
         this.m_read         = (StringExpressionSet)null;
         this.m_write        = (StringExpressionSet)null;
         string str1 = esd.Attribute("Read");
         if (str1 != null)
         {
             this.m_read = (StringExpressionSet) new EnvironmentStringExpressionSet(str1);
         }
         string str2 = esd.Attribute("Write");
         if (str2 == null)
         {
             return;
         }
         this.m_write = (StringExpressionSet) new EnvironmentStringExpressionSet(str2);
     }
 }
 /// <summary>从 XML 编码重新构造具有指定状态的权限。</summary>
 /// <param name="securityElement">
 /// <see cref="T:System.Security.SecurityElement" />,包含用于重新构造权限的 XML 编码。</param>
 /// <exception cref="T:System.ArgumentNullException">
 /// <paramref name="securityElement" /> 为 null。</exception>
 /// <exception cref="T:System.ArgumentException">
 /// <paramref name="securityElement" /> 不是一个有效的权限元素。- 或 -不支持 <paramref name="securityElement" /> 的版本号。</exception>
 public override void FromXml(SecurityElement securityElement)
 {
     CodeAccessPermission.ValidateElement(securityElement, (IPermission)this);
     if (XMLUtil.IsUnrestricted(securityElement))
     {
         this.m_flags         = KeyContainerPermissionFlags.AllFlags;
         this.m_accessEntries = new KeyContainerPermissionAccessEntryCollection(this.m_flags);
     }
     else
     {
         this.m_flags = KeyContainerPermissionFlags.NoFlags;
         string str = securityElement.Attribute("Flags");
         if (str != null)
         {
             KeyContainerPermissionFlags flags = (KeyContainerPermissionFlags)Enum.Parse(typeof(KeyContainerPermissionFlags), str);
             KeyContainerPermission.VerifyFlags(flags);
             this.m_flags = flags;
         }
         this.m_accessEntries = new KeyContainerPermissionAccessEntryCollection(this.m_flags);
         if (securityElement.InternalChildren == null || securityElement.InternalChildren.Count == 0)
         {
             return;
         }
         foreach (SecurityElement child in securityElement.Children)
         {
             if (child != null && string.Equals(child.Tag, "AccessList"))
             {
                 this.AddAccessEntries(child);
             }
         }
     }
 }
Exemple #8
0
        /// <summary>Reconstructs a permission with a specified state from an XML encoding.</summary>
        /// <param name="esd">The XML encoding to use to reconstruct the permission. </param>
        /// <exception cref="T:System.ArgumentNullException">The <paramref name="esd" /> parameter is <see langword="null" />. </exception>
        /// <exception cref="T:System.ArgumentException">The <paramref name="esd" /> parameter is not a valid permission element.-or- The <paramref name="esd" /> parameter's version number is not valid. </exception>
        // Token: 0x0600252B RID: 9515 RVA: 0x00087450 File Offset: 0x00085650
        public override void FromXml(SecurityElement esd)
        {
            CodeAccessPermission.ValidateElement(esd, this);
            this.m_allowed = IsolatedStorageContainment.None;
            if (XMLUtil.IsUnrestricted(esd))
            {
                this.m_allowed = IsolatedStorageContainment.UnrestrictedIsolatedStorage;
            }
            else
            {
                string text = esd.Attribute("Allowed");
                if (text != null)
                {
                    this.m_allowed = (IsolatedStorageContainment)Enum.Parse(typeof(IsolatedStorageContainment), text);
                }
            }
            if (this.m_allowed == IsolatedStorageContainment.UnrestrictedIsolatedStorage)
            {
                this.m_userQuota      = long.MaxValue;
                this.m_machineQuota   = long.MaxValue;
                this.m_expirationDays = long.MaxValue;
                this.m_permanentData  = true;
                return;
            }
            string text2 = esd.Attribute("UserQuota");

            this.m_userQuota      = ((text2 != null) ? long.Parse(text2, CultureInfo.InvariantCulture) : 0L);
            text2                 = esd.Attribute("MachineQuota");
            this.m_machineQuota   = ((text2 != null) ? long.Parse(text2, CultureInfo.InvariantCulture) : 0L);
            text2                 = esd.Attribute("Expiry");
            this.m_expirationDays = ((text2 != null) ? long.Parse(text2, CultureInfo.InvariantCulture) : 0L);
            text2                 = esd.Attribute("Permanent");
            this.m_permanentData  = (text2 != null && bool.Parse(text2));
        }
Exemple #9
0
        /// <include file='doc\FileIOPermission.uex' path='docs/doc[@for="FileIOPermission.FromXml"]/*' />
        public override void FromXml(SecurityElement esd)
        {
            CodeAccessPermission.ValidateElement(esd, this);
            String et;

            if (XMLUtil.IsUnrestricted(esd))
            {
                m_unrestricted = true;
                return;
            }


            m_unrestricted = false;

            et = esd.Attribute("Read");
            if (et != null)
            {
                m_read = new FileIOAccess(et);
            }
            else
            {
                m_read = null;
            }

            et = esd.Attribute("Write");
            if (et != null)
            {
                m_write = new FileIOAccess(et);
            }
            else
            {
                m_write = null;
            }

            et = esd.Attribute("Append");
            if (et != null)
            {
                m_append = new FileIOAccess(et);
            }
            else
            {
                m_append = null;
            }

            et = esd.Attribute("PathDiscovery");
            if (et != null)
            {
                m_pathDiscovery = new FileIOAccess(et);
                m_pathDiscovery.PathDiscovery = true;
            }
            else
            {
                m_pathDiscovery = null;
            }
        }
Exemple #10
0
 public override void FromXml(SecurityElement esd)
 {
     CodeAccessPermission.ValidateElement( esd, this );
     if (XMLUtil.IsUnrestricted( esd ))
         Resources = HostProtectionResource.All;
     else
     {
         String resources = esd.Attribute( "Resources" );
         if (resources == null)
             Resources = HostProtectionResource.None;
         else
             Resources = (HostProtectionResource)Enum.Parse( typeof( HostProtectionResource ), resources );
     }
 }
        /// <summary>Reconstructs a permission with a specified state from an XML encoding.</summary>
        /// <param name="esd">The XML encoding used to reconstruct the permission. </param>
        /// <exception cref="T:System.ArgumentNullException">The <paramref name="esd" /> parameter is <see langword="null" />. </exception>
        /// <exception cref="T:System.ArgumentException">The <paramref name="esd" /> parameter is not a valid permission element.-or- The version number of the <paramref name="esd" /> parameter is not supported. </exception>
        // Token: 0x060024AC RID: 9388 RVA: 0x00085214 File Offset: 0x00083414
        public override void FromXml(SecurityElement esd)
        {
            CodeAccessPermission.ValidateElement(esd, this);
            if (XMLUtil.IsUnrestricted(esd))
            {
                this.SetUnrestricted(true);
                return;
            }
            this.access = FileDialogPermissionAccess.None;
            string text = esd.Attribute("Access");

            if (text != null)
            {
                this.access = (FileDialogPermissionAccess)Enum.Parse(typeof(FileDialogPermissionAccess), text);
            }
        }
Exemple #12
0
        // Token: 0x0600251A RID: 9498 RVA: 0x000871C0 File Offset: 0x000853C0
        public override void FromXml(SecurityElement esd)
        {
            CodeAccessPermission.ValidateElement(esd, this);
            if (XMLUtil.IsUnrestricted(esd))
            {
                this.Resources = HostProtectionResource.All;
                return;
            }
            string text = esd.Attribute("Resources");

            if (text == null)
            {
                this.Resources = HostProtectionResource.None;
                return;
            }
            this.Resources = (HostProtectionResource)Enum.Parse(typeof(HostProtectionResource), text);
        }
Exemple #13
0
        /// <summary>Reconstructs a permission with a specified state from an XML encoding.</summary>
        /// <param name="esd">The XML encoding to use to reconstruct the permission. </param>
        /// <exception cref="T:System.ArgumentNullException">The <paramref name="esd" /> parameter is <see langword="null" />. </exception>
        /// <exception cref="T:System.ArgumentException">The <paramref name="esd" /> parameter is not a valid permission element.-or- The <paramref name="esd" /> parameter's version number is not valid. </exception>
        // Token: 0x060025F8 RID: 9720 RVA: 0x000889DC File Offset: 0x00086BDC
        public override void FromXml(SecurityElement esd)
        {
            CodeAccessPermission.ValidateElement(esd, this);
            if (XMLUtil.IsUnrestricted(esd))
            {
                this.m_flags = (ReflectionPermissionFlag.TypeInformation | ReflectionPermissionFlag.MemberAccess | ReflectionPermissionFlag.ReflectionEmit | ReflectionPermissionFlag.RestrictedMemberAccess);
                return;
            }
            this.Reset();
            this.SetUnrestricted(false);
            string text = esd.Attribute("Flags");

            if (text != null)
            {
                this.m_flags = (ReflectionPermissionFlag)Enum.Parse(typeof(ReflectionPermissionFlag), text);
            }
        }
        /// <summary>Reconstructs a permission with a specified state from an XML encoding.</summary>
        /// <param name="esd">The XML encoding to use to reconstruct the permission. </param>
        /// <exception cref="T:System.ArgumentNullException">The <paramref name="esd" /> parameter is <see langword="null" />. </exception>
        /// <exception cref="T:System.ArgumentException">The <paramref name="esd" /> parameter is not a valid permission element.-or- The <paramref name="esd" /> parameter's version number is not supported. </exception>
        // Token: 0x06002621 RID: 9761 RVA: 0x000898EC File Offset: 0x00087AEC
        public override void FromXml(SecurityElement esd)
        {
            CodeAccessPermission.ValidateElement(esd, this);
            if (XMLUtil.IsUnrestricted(esd))
            {
                this.m_flags = SecurityPermissionFlag.AllFlags;
                return;
            }
            this.Reset();
            this.SetUnrestricted(false);
            string text = esd.Attribute("Flags");

            if (text != null)
            {
                this.m_flags = (SecurityPermissionFlag)Enum.Parse(typeof(SecurityPermissionFlag), text);
            }
        }
Exemple #15
0
 public override void FromXml(SecurityElement esd)
 {
     CodeAccessPermission.ValidateElement(esd, this);
     if (XMLUtil.IsUnrestricted(esd))
     {
         this.m_flags = ReflectionPermissionFlag.RestrictedMemberAccess | ReflectionPermissionFlag.AllFlags;
     }
     else
     {
         this.Reset();
         this.SetUnrestricted(false);
         string str = esd.Attribute("Flags");
         if (str != null)
         {
             this.m_flags = (ReflectionPermissionFlag)Enum.Parse(typeof(ReflectionPermissionFlag), str);
         }
     }
 }
Exemple #16
0
        public override void FromXml(SecurityElement esd)
        {
            CodeAccessPermission.ValidateElement(esd, this);

            m_allowed = IsolatedStorageContainment.None;    // default if no match

            if (XMLUtil.IsUnrestricted(esd))
            {
                m_allowed = IsolatedStorageContainment.UnrestrictedIsolatedStorage;
            }
            else
            {
                String allowed = esd.Attribute("Allowed");

                if (allowed != null)
                {
                    m_allowed = (IsolatedStorageContainment)Enum.Parse(typeof(IsolatedStorageContainment), allowed);
                }
            }

            if (m_allowed == IsolatedStorageContainment.UnrestrictedIsolatedStorage)
            {
                m_userQuota      = Int64.MaxValue;
                m_machineQuota   = Int64.MaxValue;
                m_expirationDays = Int64.MaxValue;
                m_permanentData  = true;
            }
            else
            {
                String param;
                param       = esd.Attribute(_strUserQuota);
                m_userQuota = param != null?Int64.Parse(param, CultureInfo.InvariantCulture) : 0;

                param          = esd.Attribute(_strMachineQuota);
                m_machineQuota = param != null?Int64.Parse(param, CultureInfo.InvariantCulture) : 0;

                param            = esd.Attribute(_strExpiry);
                m_expirationDays = param != null?Int64.Parse(param, CultureInfo.InvariantCulture) : 0;

                param           = esd.Attribute(_strPermDat);
                m_permanentData = param != null ? (Boolean.Parse(param)) : false;
            }
        }
 /// <summary>从 XML 编码重新构造具有指定状态的权限。</summary>
 /// <param name="esd">用于重新构造权限的 XML 编码。</param>
 /// <exception cref="T:System.ArgumentNullException">
 /// <paramref name="esd" /> 参数为 null。</exception>
 /// <exception cref="T:System.ArgumentException">
 /// <paramref name="esd" /> 参数不是有效的权限元素。- 或 -<paramref name="esd" /> 参数的版本号无效。</exception>
 public override void FromXml(SecurityElement esd)
 {
     CodeAccessPermission.ValidateElement(esd, (IPermission)this);
     if (XMLUtil.IsUnrestricted(esd))
     {
         this.m_unrestricted = true;
     }
     else
     {
         this.m_unrestricted = false;
         this.m_read         = (StringExpressionSet)null;
         this.m_write        = (StringExpressionSet)null;
         this.m_create       = (StringExpressionSet)null;
         this.m_viewAcl      = (StringExpressionSet)null;
         this.m_changeAcl    = (StringExpressionSet)null;
         string str1 = esd.Attribute("Read");
         if (str1 != null)
         {
             this.m_read = new StringExpressionSet(str1);
         }
         string str2 = esd.Attribute("Write");
         if (str2 != null)
         {
             this.m_write = new StringExpressionSet(str2);
         }
         string str3 = esd.Attribute("Create");
         if (str3 != null)
         {
             this.m_create = new StringExpressionSet(str3);
         }
         string str4 = esd.Attribute("ViewAccessControl");
         if (str4 != null)
         {
             this.m_viewAcl = new StringExpressionSet(str4);
         }
         string str5 = esd.Attribute("ChangeAccessControl");
         if (str5 == null)
         {
             return;
         }
         this.m_changeAcl = new StringExpressionSet(str5);
     }
 }
Exemple #18
0
        public override void FromXml(SecurityElement esd)
        {
            CodeAccessPermission.ValidateElement(esd, this);
            if (XMLUtil.IsUnrestricted(esd))
            {
                m_flags = ReflectionPermission.AllFlagsAndMore;
                return;
            }

            Reset();
            SetUnrestricted(false);

            String flags = esd.Attribute("Flags");

            if (flags != null)
            {
                m_flags = (ReflectionPermissionFlag)Enum.Parse(typeof(ReflectionPermissionFlag), flags);
            }
        }
 public override void FromXml(SecurityElement esd)
 {
     CodeAccessPermission.ValidateElement(esd, this);
     if (XMLUtil.IsUnrestricted(esd))
     {
         this.m_unrestricted = true;
     }
     else
     {
         this.m_unrestricted = false;
         this.m_read         = null;
         this.m_write        = null;
         this.m_create       = null;
         this.m_viewAcl      = null;
         this.m_changeAcl    = null;
         string str = esd.Attribute("Read");
         if (str != null)
         {
             this.m_read = new StringExpressionSet(str);
         }
         str = esd.Attribute("Write");
         if (str != null)
         {
             this.m_write = new StringExpressionSet(str);
         }
         str = esd.Attribute("Create");
         if (str != null)
         {
             this.m_create = new StringExpressionSet(str);
         }
         str = esd.Attribute("ViewAccessControl");
         if (str != null)
         {
             this.m_viewAcl = new StringExpressionSet(str);
         }
         str = esd.Attribute("ChangeAccessControl");
         if (str != null)
         {
             this.m_changeAcl = new StringExpressionSet(str);
         }
     }
 }
 public override void FromXml(SecurityElement esd)
 {
     CodeAccessPermission.ValidateElement(esd, (IPermission)this);
     if (XMLUtil.IsUnrestricted(esd))
     {
         this.Resources = HostProtectionResource.All;
     }
     else
     {
         string str = esd.Attribute("Resources");
         if (str == null)
         {
             this.Resources = HostProtectionResource.None;
         }
         else
         {
             this.Resources = (HostProtectionResource)Enum.Parse(typeof(HostProtectionResource), str);
         }
     }
 }
Exemple #21
0
 public override void FromXml(SecurityElement esd)
 {
     CodeAccessPermission.ValidateElement(esd, (IPermission)this);
     if (XMLUtil.IsUnrestricted(esd))
     {
         this.m_unrestricted = true;
     }
     else
     {
         this.m_unrestricted = false;
         string str1 = esd.Attribute("Read");
         this.m_read = str1 == null ? (FileIOAccess)null : new FileIOAccess(str1);
         string str2 = esd.Attribute("Write");
         this.m_write = str2 == null ? (FileIOAccess)null : new FileIOAccess(str2);
         string str3 = esd.Attribute("Append");
         this.m_append = str3 == null ? (FileIOAccess)null : new FileIOAccess(str3);
         string str4 = esd.Attribute("PathDiscovery");
         if (str4 != null)
         {
             this.m_pathDiscovery = new FileIOAccess(str4);
             this.m_pathDiscovery.PathDiscovery = true;
         }
         else
         {
             this.m_pathDiscovery = (FileIOAccess)null;
         }
         string str5 = esd.Attribute("ViewAcl");
         this.m_viewAcl = str5 == null ? (FileIOAccess)null : new FileIOAccess(str5);
         string str6 = esd.Attribute("ChangeAcl");
         if (str6 != null)
         {
             this.m_changeAcl = new FileIOAccess(str6);
         }
         else
         {
             this.m_changeAcl = (FileIOAccess)null;
         }
     }
 }
        /// <summary>从 XML 编码重新构造具有指定状态的权限。</summary>
        /// <param name="esd">用于重新构造权限的 XML 编码。</param>
        /// <exception cref="T:System.ArgumentNullException">
        /// <paramref name="esd" /> 参数为 null。</exception>
        /// <exception cref="T:System.ArgumentException">
        /// <paramref name="esd" /> 参数不是有效的权限元素。- 或 -<paramref name="esd" /> 参数的版本号无效。</exception>
        public override void FromXml(SecurityElement esd)
        {
            CodeAccessPermission.ValidateElement(esd, (IPermission)this);
            this.m_allowed = IsolatedStorageContainment.None;
            if (XMLUtil.IsUnrestricted(esd))
            {
                this.m_allowed = IsolatedStorageContainment.UnrestrictedIsolatedStorage;
            }
            else
            {
                string str = esd.Attribute("Allowed");
                if (str != null)
                {
                    this.m_allowed = (IsolatedStorageContainment)Enum.Parse(typeof(IsolatedStorageContainment), str);
                }
            }
            if (this.m_allowed == IsolatedStorageContainment.UnrestrictedIsolatedStorage)
            {
                this.m_userQuota      = long.MaxValue;
                this.m_machineQuota   = long.MaxValue;
                this.m_expirationDays = long.MaxValue;
                this.m_permanentData  = true;
            }
            else
            {
                string s1 = esd.Attribute("UserQuota");
                this.m_userQuota = s1 != null?long.Parse(s1, (IFormatProvider)CultureInfo.InvariantCulture) : 0L;

                string s2 = esd.Attribute("MachineQuota");
                this.m_machineQuota = s2 != null?long.Parse(s2, (IFormatProvider)CultureInfo.InvariantCulture) : 0L;

                string s3 = esd.Attribute("Expiry");
                this.m_expirationDays = s3 != null?long.Parse(s3, (IFormatProvider)CultureInfo.InvariantCulture) : 0L;

                string str = esd.Attribute("Permanent");
                this.m_permanentData = str != null && bool.Parse(str);
            }
        }
        /// <summary>Reconstructs a permission with a specified state from an XML encoding.</summary>
        /// <param name="esd">The XML encoding used to reconstruct the permission. </param>
        /// <exception cref="T:System.ArgumentNullException">The <paramref name="esd" /> parameter is <see langword="null" />. </exception>
        /// <exception cref="T:System.ArgumentException">The <paramref name="esd" /> parameter is not a valid permission element.-or- The <paramref name="esd" /> parameter's version number is not valid. </exception>
        // Token: 0x06002663 RID: 9827 RVA: 0x0008AF50 File Offset: 0x00089150
        public override void FromXml(SecurityElement esd)
        {
            CodeAccessPermission.ValidateElement(esd, this);
            if (XMLUtil.IsUnrestricted(esd))
            {
                this.SetUnrestricted(true);
                return;
            }
            this.m_windowFlag    = UIPermissionWindow.NoWindows;
            this.m_clipboardFlag = UIPermissionClipboard.NoClipboard;
            string text = esd.Attribute("Window");

            if (text != null)
            {
                this.m_windowFlag = (UIPermissionWindow)Enum.Parse(typeof(UIPermissionWindow), text);
            }
            string text2 = esd.Attribute("Clipboard");

            if (text2 != null)
            {
                this.m_clipboardFlag = (UIPermissionClipboard)Enum.Parse(typeof(UIPermissionClipboard), text2);
            }
        }
Exemple #24
0
 /// <summary>
 /// Recupera os dados da permissão do elemento de segurança informado.
 /// </summary>
 /// <param name="esd"></param>
 public void FromXml(SecurityElement esd)
 {
     ValidateElement(esd, this);
     if (XMLUtil.IsUnrestricted(esd))
     {
         _unrestricted = true;
     }
     else
     {
         _unrestricted = false;
         string str = esd.Attribute("Read");
         if (str != null)
         {
             _read = new SystemAccess(str.TrimStart().TrimEnd());
         }
         else
         {
             _read = null;
         }
         str = esd.Attribute("Write");
         if (str != null)
         {
             _write = new SystemAccess(str.TrimStart().TrimEnd());
         }
         else
         {
             _write = null;
         }
         str = esd.Attribute("Execute");
         if (str != null)
         {
             _execute = new SystemAccess(str.TrimStart().TrimEnd());
         }
         else
         {
             _execute = null;
         }
         str = esd.Attribute("PathDiscovery");
         if (str != null)
         {
             _pathDiscovery = new SystemAccess(str.TrimStart().TrimEnd());
             _pathDiscovery.PathDiscovery = true;
         }
         else
         {
             _pathDiscovery = null;
         }
         str = esd.Attribute("ViewAcl");
         if (str != null)
         {
             _viewAcl = new SystemAccess(str.TrimStart().TrimEnd());
         }
         else
         {
             _viewAcl = null;
         }
         str = esd.Attribute("ChangeAcl");
         if (str != null)
         {
             _changeAcl = new SystemAccess(str.TrimStart().TrimEnd());
         }
         else
         {
             _changeAcl = null;
         }
     }
 }
 public override void FromXml(SecurityElement esd)
 {
     CodeAccessPermission.ValidateElement(esd, this);
     if (XMLUtil.IsUnrestricted(esd))
     {
         this.m_unrestricted = true;
     }
     else
     {
         this.m_unrestricted = false;
         string str = esd.Attribute("Read");
         if (str != null)
         {
             this.m_read = new FileIOAccess(str);
         }
         else
         {
             this.m_read = null;
         }
         str = esd.Attribute("Write");
         if (str != null)
         {
             this.m_write = new FileIOAccess(str);
         }
         else
         {
             this.m_write = null;
         }
         str = esd.Attribute("Append");
         if (str != null)
         {
             this.m_append = new FileIOAccess(str);
         }
         else
         {
             this.m_append = null;
         }
         str = esd.Attribute("PathDiscovery");
         if (str != null)
         {
             this.m_pathDiscovery = new FileIOAccess(str);
             this.m_pathDiscovery.PathDiscovery = true;
         }
         else
         {
             this.m_pathDiscovery = null;
         }
         str = esd.Attribute("ViewAcl");
         if (str != null)
         {
             this.m_viewAcl = new FileIOAccess(str);
         }
         else
         {
             this.m_viewAcl = null;
         }
         str = esd.Attribute("ChangeAcl");
         if (str != null)
         {
             this.m_changeAcl = new FileIOAccess(str);
         }
         else
         {
             this.m_changeAcl = null;
         }
     }
 }