public override void FromXml(SecurityElement securityElement) { if (securityElement == null) { throw new ArgumentNullException("securityElement"); } string str = securityElement.Attribute("class"); if ((str == null) || (str.IndexOf(base.GetType().FullName, StringComparison.Ordinal) == -1)) { throw new ArgumentException(SR.GetString("Argument_InvalidClassAttribute"), "securityElement"); } string strA = securityElement.Attribute("Unrestricted"); if ((strA != null) && (string.Compare(strA, "true", StringComparison.OrdinalIgnoreCase) == 0)) { this.m_flags = TypeDescriptorPermissionFlags.RestrictedRegistrationAccess; } else { this.m_flags = TypeDescriptorPermissionFlags.NoFlags; string str3 = securityElement.Attribute("Flags"); if (str3 != null) { TypeDescriptorPermissionFlags flags = (TypeDescriptorPermissionFlags)Enum.Parse(typeof(TypeDescriptorPermissionFlags), str3); VerifyFlags(flags); this.m_flags = flags; } } }
public override void FromXml(SecurityElement securityElement) { if (securityElement == null) { throw new ArgumentNullException("securityElement"); } string str = securityElement.Attribute("class"); if ((str == null) || (str.IndexOf(base.GetType().FullName, StringComparison.Ordinal) == -1)) { throw new ArgumentException(SR.GetString("Argument_InvalidClassAttribute"), "securityElement"); } string strA = securityElement.Attribute("Unrestricted"); if ((strA != null) && (string.Compare(strA, "true", StringComparison.OrdinalIgnoreCase) == 0)) { this.m_flags = TypeDescriptorPermissionFlags.RestrictedRegistrationAccess; } else { this.m_flags = TypeDescriptorPermissionFlags.NoFlags; string str3 = securityElement.Attribute("Flags"); if (str3 != null) { TypeDescriptorPermissionFlags flags = (TypeDescriptorPermissionFlags) Enum.Parse(typeof(TypeDescriptorPermissionFlags), str3); VerifyFlags(flags); this.m_flags = flags; } } }
public override IPermission Intersect(IPermission target) { if (target == null) { return(null); } try { TypeDescriptorPermission operand = (TypeDescriptorPermission)target; TypeDescriptorPermissionFlags flag_intersect = operand.m_flags & this.m_flags; if (flag_intersect == TypeDescriptorPermissionFlags.NoFlags) { return(null); } else { return(new TypeDescriptorPermission(flag_intersect)); } } catch (InvalidCastException) { throw new ArgumentException(String.Format(CultureInfo.CurrentCulture, SR.GetString(SR.Argument_WrongType), this.GetType().FullName)); } }
public override void FromXml(SecurityElement securityElement) { if (securityElement == null) { throw new ArgumentNullException("securityElement"); } string className = securityElement.Attribute("class"); if (className == null || className.IndexOf(this.GetType().FullName, StringComparison.Ordinal) == -1) { throw new ArgumentException(SR.GetString(SR.Argument_InvalidClassAttribute), "securityElement"); } string unrestricted = securityElement.Attribute("Unrestricted"); if (unrestricted != null && String.Compare(unrestricted, "true", StringComparison.OrdinalIgnoreCase) == 0) { m_flags = TypeDescriptorPermissionFlags.RestrictedRegistrationAccess; return; } m_flags = TypeDescriptorPermissionFlags.NoFlags; String strFlags = securityElement.Attribute("Flags"); if (strFlags != null) { TypeDescriptorPermissionFlags flags = (TypeDescriptorPermissionFlags)Enum.Parse(typeof(TypeDescriptorPermissionFlags), strFlags); VerifyFlags(flags); m_flags = flags; } }
internal static void VerifyFlags(TypeDescriptorPermissionFlags flags) { if ((flags & ~TypeDescriptorPermissionFlags.RestrictedRegistrationAccess) != 0) { throw new ArgumentException(String.Format(CultureInfo.CurrentCulture, SR.GetString(SR.Arg_EnumIllegalVal), (int)flags)); } }
public TypeDescriptorPermission(TypeDescriptorPermissionFlags flag) { VerifyAccess(flag); SetUnrestricted(false); m_flags = flag; }
private void VerifyAccess(TypeDescriptorPermissionFlags type) { if ((type & ~TypeDescriptorPermissionFlags.RestrictedRegistrationAccess) != TypeDescriptorPermissionFlags.NoFlags) { throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, SR.GetString("Arg_EnumIllegalVal"), new object[] { (int)type })); } }
private void VerifyAccess(TypeDescriptorPermissionFlags type) { if ((type & ~TypeDescriptorPermissionFlags.RestrictedRegistrationAccess) != 0) { throw new ArgumentException(String.Format(CultureInfo.CurrentCulture, SR.GetString(SR.Arg_EnumIllegalVal), (int)type)); } Contract.EndContractBlock(); }
public void LegacyRequiresReferencingPrivateStuffInThrow(TypeDescriptorPermissionFlags type) { if ((type & ~TypeDescriptorPermissionFlags.RestrictedRegistrationAccess) != 0) { throw new ArgumentException(String.Format(SR.GetString(SR.Arg_EnumIllegalVal), (int)type)); } Contract.EndContractBlock(); }
private void SetUnrestricted(bool unrestricted) { if (unrestricted) { m_flags = TypeDescriptorPermissionFlags.RestrictedRegistrationAccess; } else { Reset(); } }
public override bool IsSubsetOf(IPermission target) { if (target == null) { return(m_flags == TypeDescriptorPermissionFlags.NoFlags); } try { TypeDescriptorPermission operand = (TypeDescriptorPermission)target; TypeDescriptorPermissionFlags sourceFlag = this.m_flags; TypeDescriptorPermissionFlags targetFlag = operand.m_flags; return((sourceFlag & targetFlag) == sourceFlag); } catch (InvalidCastException) { throw new ArgumentException(String.Format(CultureInfo.CurrentCulture, SR.GetString(SR.Argument_WrongType), this.GetType().FullName)); } }
public override bool IsSubsetOf(IPermission target) { bool flag; if (target == null) { return(this.m_flags == TypeDescriptorPermissionFlags.NoFlags); } try { TypeDescriptorPermission permission = (TypeDescriptorPermission)target; TypeDescriptorPermissionFlags flags = this.m_flags; TypeDescriptorPermissionFlags flags2 = permission.m_flags; flag = (flags & flags2) == flags; } catch (InvalidCastException) { throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, SR.GetString("Argument_WrongType"), new object[] { base.GetType().FullName })); } return(flag); }
public override IPermission Intersect(IPermission target) { IPermission permission2; if (target == null) { return(null); } try { TypeDescriptorPermission permission = (TypeDescriptorPermission)target; TypeDescriptorPermissionFlags flag = permission.m_flags & this.m_flags; if (flag == TypeDescriptorPermissionFlags.NoFlags) { return(null); } permission2 = new TypeDescriptorPermission(flag); } catch (InvalidCastException) { throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, SR.GetString("Argument_WrongType"), new object[] { base.GetType().FullName })); } return(permission2); }
public TypeDescriptorPermission(TypeDescriptorPermissionFlags flag) { }
private void Reset() { m_flags = TypeDescriptorPermissionFlags.NoFlags; }
private void VerifyAccess(TypeDescriptorPermissionFlags type) { if ((type & ~TypeDescriptorPermissionFlags.RestrictedRegistrationAccess) != TypeDescriptorPermissionFlags.NoFlags) { throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, SR.GetString("Arg_EnumIllegalVal"), new object[] { (int) type })); } }
internal static void VerifyFlags(TypeDescriptorPermissionFlags flags) { if ((flags & ~TypeDescriptorPermissionFlags.RestrictedRegistrationAccess) != TypeDescriptorPermissionFlags.NoFlags) { throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, SR.GetString("Arg_EnumIllegalVal"), new object[] { (int) flags })); } }
private void VerifyAccess(TypeDescriptorPermissionFlags type) { if ((type & ~TypeDescriptorPermissionFlags.RestrictedRegistrationAccess) != 0) throw new ArgumentException(String.Format(CultureInfo.CurrentCulture, SR.GetString(SR.Arg_EnumIllegalVal), (int)type)); Contract.EndContractBlock(); }
public TypeDescriptorPermission(TypeDescriptorPermissionFlags flag) { throw new NotImplementedException(); }
public override void FromXml(SecurityElement securityElement) { if (securityElement == null) throw new ArgumentNullException("securityElement"); string className = securityElement.Attribute("class"); if (className == null || className.IndexOf(this.GetType().FullName, StringComparison.Ordinal) == -1) throw new ArgumentException(SR.GetString(SR.Argument_InvalidClassAttribute), "securityElement"); string unrestricted = securityElement.Attribute("Unrestricted"); if (unrestricted != null && String.Compare(unrestricted, "true", StringComparison.OrdinalIgnoreCase) == 0) { m_flags = TypeDescriptorPermissionFlags.RestrictedRegistrationAccess; return; } m_flags = TypeDescriptorPermissionFlags.NoFlags; String strFlags = securityElement.Attribute("Flags"); if (strFlags != null) { TypeDescriptorPermissionFlags flags = (TypeDescriptorPermissionFlags)Enum.Parse(typeof(TypeDescriptorPermissionFlags), strFlags); VerifyFlags(flags); m_flags = flags; } }
internal static void VerifyFlags(TypeDescriptorPermissionFlags flags) { if ((flags & ~TypeDescriptorPermissionFlags.RestrictedRegistrationAccess) != 0) throw new ArgumentException(String.Format(CultureInfo.CurrentCulture, SR.GetString(SR.Arg_EnumIllegalVal), (int)flags)); }