using System; using System.Runtime.InteropServices; namespace System.Security.Policy { /// Allows security policy to be defined by the union of the policy statement of a code group and that of the first child code group that matches. This class cannot be inherited. // Token: 0x0200058A RID: 1418 [ComVisible(true)] [Serializable] public sealed class FirstMatchCodeGroup : CodeGroup { /// Initializes a new instance of the class. /// A membership condition that tests evidence to determine whether this code group applies policy. /// The policy statement for the code group in the form of a permission set and attributes to grant code that matches the membership condition. /// The type of the parameter is not valid.-or- The type of the parameter is not valid. // Token: 0x060033E6 RID: 13286 RVA: 0x000B2994 File Offset: 0x000B0B94 public FirstMatchCodeGroup(IMembershipCondition membershipCondition, PolicyStatement policy) : base(membershipCondition, policy) { } // Token: 0x060033E7 RID: 13287 RVA: 0x000B29A0 File Offset: 0x000B0BA0 internal FirstMatchCodeGroup(SecurityElement e, PolicyLevel level) : base(e, level) { } /// Gets the merge logic. /// The string "First Match". // Token: 0x17000A3D RID: 2621 // (get) Token: 0x060033E8 RID: 13288 RVA: 0x000B29AC File Offset: 0x000B0BAC public override string MergeLogic { get { return "First Match"; } } /// Makes a deep copy of the code group. /// An equivalent copy of the code group, including its membership conditions and child code groups. /// /// /// // Token: 0x060033E9 RID: 13289 RVA: 0x000B29B4 File Offset: 0x000B0BB4 public override CodeGroup Copy() { FirstMatchCodeGroup firstMatchCodeGroup = this.CopyNoChildren(); foreach (object obj in base.Children) { CodeGroup codeGroup = (CodeGroup)obj; firstMatchCodeGroup.AddChild(codeGroup.Copy()); } return firstMatchCodeGroup; } /// Resolves policy for the code group and its descendants for a set of evidence. /// A policy statement consisting of the permissions granted by the code group with optional attributes, or null if the code group does not apply (the membership condition does not match the specified evidence). /// The evidence for the assembly. /// The parameter is null. /// More than one code group (including the parent code group and any child code groups) is marked . /// /// /// // Token: 0x060033EA RID: 13290 RVA: 0x000B2A30 File Offset: 0x000B0C30 public override PolicyStatement Resolve(Evidence evidence) { if (evidence == null) { throw new ArgumentNullException("evidence"); } if (!base.MembershipCondition.Check(evidence)) { return null; } foreach (object obj in base.Children) { CodeGroup codeGroup = (CodeGroup)obj; PolicyStatement policyStatement = codeGroup.Resolve(evidence); if (policyStatement != null) { return policyStatement; } } return base.PolicyStatement; } /// Resolves matching code groups. /// A that is the root of the tree of matching code groups. /// The evidence for the assembly. /// The parameter is null. // Token: 0x060033EB RID: 13291 RVA: 0x000B2ADC File Offset: 0x000B0CDC public override CodeGroup ResolveMatchingCodeGroups(Evidence evidence) { if (evidence == null) { throw new ArgumentNullException("evidence"); } if (!base.MembershipCondition.Check(evidence)) { return null; } foreach (object obj in base.Children) { CodeGroup codeGroup = (CodeGroup)obj; if (codeGroup.Resolve(evidence) != null) { return codeGroup.Copy(); } } return this.CopyNoChildren(); } // Token: 0x060033EC RID: 13292 RVA: 0x000B2B88 File Offset: 0x000B0D88 private FirstMatchCodeGroup CopyNoChildren() { return new FirstMatchCodeGroup(base.MembershipCondition, base.PolicyStatement) { Name = base.Name, Description = base.Description }; } } }