using System;
using System.Collections;
using System.Runtime.InteropServices;
namespace System.Security.Policy
{
/// Determines whether an assembly belongs to a code group by testing its global assembly cache membership. This class cannot be inherited.
// Token: 0x0200058C RID: 1420
[ComVisible(true)]
[Serializable]
public sealed class GacMembershipCondition : IConstantMembershipCondition, IMembershipCondition, ISecurityEncodable, ISecurityPolicyEncodable
{
/// Indicates whether the specified evidence satisfies the membership condition.
/// true if the specified evidence satisfies the membership condition; otherwise, false.
/// The against which to make the test.
// Token: 0x060033F7 RID: 13303 RVA: 0x000B2C48 File Offset: 0x000B0E48
public bool Check(Evidence evidence)
{
if (evidence == null)
{
return false;
}
IEnumerator hostEnumerator = evidence.GetHostEnumerator();
while (hostEnumerator.MoveNext())
{
if (hostEnumerator.Current is GacInstalled)
{
return true;
}
}
return false;
}
/// Creates an equivalent copy of the membership condition.
/// A new object.
// Token: 0x060033F8 RID: 13304 RVA: 0x000B2C88 File Offset: 0x000B0E88
public IMembershipCondition Copy()
{
return new GacMembershipCondition();
}
/// Indicates whether the current object is equivalent to the specified object.
/// true if is a ; otherwise, false.
/// The object to compare with the current object.
// Token: 0x060033F9 RID: 13305 RVA: 0x000B2C90 File Offset: 0x000B0E90
public override bool Equals(object o)
{
return o != null && o is GacMembershipCondition;
}
/// Uses the specified XML encoding to reconstruct a security object.
/// The that contains the XML encoding to use to reconstruct the security object.
///
/// is null.
///
/// is not a valid membership condition element.
// Token: 0x060033FA RID: 13306 RVA: 0x000B2CA4 File Offset: 0x000B0EA4
public void FromXml(SecurityElement e)
{
this.FromXml(e, null);
}
/// Uses the specified XML encoding to reconstruct a security object, using the specified policy level context.
/// The that contains the XML encoding to use to reconstruct the security object.
/// The context for resolving references.
///
/// is null.
///
/// is not a valid membership condition element.
// Token: 0x060033FB RID: 13307 RVA: 0x000B2CB0 File Offset: 0x000B0EB0
public void FromXml(SecurityElement e, PolicyLevel level)
{
MembershipConditionHelper.CheckSecurityElement(e, "e", this.version, this.version);
}
/// Gets a hash code for the current membership condition.
/// 0 (zero).
// Token: 0x060033FC RID: 13308 RVA: 0x000B2CCC File Offset: 0x000B0ECC
public override int GetHashCode()
{
return 0;
}
/// Returns a string representation of the membership condition.
/// A string representation of the membership condition.
// Token: 0x060033FD RID: 13309 RVA: 0x000B2CD0 File Offset: 0x000B0ED0
public override string ToString()
{
return "GAC";
}
/// Creates an XML encoding of the security object and its current state.
/// A that contains the XML encoding of the security object, including any state information.
// Token: 0x060033FE RID: 13310 RVA: 0x000B2CD8 File Offset: 0x000B0ED8
public SecurityElement ToXml()
{
return this.ToXml(null);
}
/// Creates an XML encoding of the security object and its current state, using the specified policy level context.
/// A that contains the XML encoding of the security object, including any state information.
/// The context for resolving references.
// Token: 0x060033FF RID: 13311 RVA: 0x000B2CE4 File Offset: 0x000B0EE4
public SecurityElement ToXml(PolicyLevel level)
{
return MembershipConditionHelper.Element(typeof(GacMembershipCondition), this.version);
}
// Token: 0x04001550 RID: 5456
private readonly int version = 1;
}
}