Code:
/ Dotnetfx_Win7_3.5.1 / Dotnetfx_Win7_3.5.1 / 3.5.1 / DEVDIV / depot / DevDiv / releases / whidbey / NetFXspW7 / ndp / clr / src / BCL / System / Security / Policy / GACMembershipCondition.cs / 1 / GACMembershipCondition.cs
// ==++==
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
// ==--==
//
// GacMembershipCondition.cs
//
// Implementation of membership condition for being in the Gac
//
namespace System.Security.Policy {
using System;
using System.Collections;
using System.Globalization;
[Serializable]
[System.Runtime.InteropServices.ComVisible(true)]
sealed public class GacMembershipCondition : IMembershipCondition, IConstantMembershipCondition, IReportMatchMembershipCondition
{
//------------------------------------------------------
//
// PUBLIC CONSTRUCTORS
//
//-----------------------------------------------------
public GacMembershipCondition()
{
}
//-----------------------------------------------------
//
// IMEMBERSHIPCONDITION IMPLEMENTATION
//
//-----------------------------------------------------
public bool Check( Evidence evidence )
{
object usedEvidence = null;
return (this as IReportMatchMembershipCondition).Check(evidence, out usedEvidence);
}
bool IReportMatchMembershipCondition.Check(Evidence evidence, out object usedEvidence)
{
usedEvidence = null;
if (evidence == null)
return false;
IEnumerator enumerator = evidence.GetHostEnumerator();
while (enumerator.MoveNext())
{
Object obj = enumerator.Current;
if (obj is GacInstalled)
{
usedEvidence = obj;
return true;
}
}
return false;
}
public IMembershipCondition Copy()
{
return new GacMembershipCondition();
}
public SecurityElement ToXml()
{
return ToXml( null );
}
public void FromXml( SecurityElement e )
{
FromXml( e, null );
}
public SecurityElement ToXml( PolicyLevel level )
{
SecurityElement root = new SecurityElement( "IMembershipCondition" );
System.Security.Util.XMLUtil.AddClassAttribute( root, this.GetType(), this.GetType().FullName );
root.AddAttribute( "version", "1" );
return root;
}
public void FromXml( SecurityElement e, PolicyLevel level )
{
if (e == null)
throw new ArgumentNullException("e");
if (!e.Tag.Equals( "IMembershipCondition" ))
throw new ArgumentException( Environment.GetResourceString( "Argument_MembershipConditionElement" ) );
}
public override bool Equals( Object o )
{
GacMembershipCondition that = (o as GacMembershipCondition);
if (that != null)
return true;
return false;
}
public override int GetHashCode()
{
return 0;
}
public override String ToString()
{
return Environment.GetResourceString( "GAC_ToString" );
}
}
}
// File provided for Reference Use Only by Microsoft Corporation (c) 2007.
// ==++==
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
// ==--==
//
// GacMembershipCondition.cs
//
// Implementation of membership condition for being in the Gac
//
namespace System.Security.Policy {
using System;
using System.Collections;
using System.Globalization;
[Serializable]
[System.Runtime.InteropServices.ComVisible(true)]
sealed public class GacMembershipCondition : IMembershipCondition, IConstantMembershipCondition, IReportMatchMembershipCondition
{
//------------------------------------------------------
//
// PUBLIC CONSTRUCTORS
//
//-----------------------------------------------------
public GacMembershipCondition()
{
}
//-----------------------------------------------------
//
// IMEMBERSHIPCONDITION IMPLEMENTATION
//
//-----------------------------------------------------
public bool Check( Evidence evidence )
{
object usedEvidence = null;
return (this as IReportMatchMembershipCondition).Check(evidence, out usedEvidence);
}
bool IReportMatchMembershipCondition.Check(Evidence evidence, out object usedEvidence)
{
usedEvidence = null;
if (evidence == null)
return false;
IEnumerator enumerator = evidence.GetHostEnumerator();
while (enumerator.MoveNext())
{
Object obj = enumerator.Current;
if (obj is GacInstalled)
{
usedEvidence = obj;
return true;
}
}
return false;
}
public IMembershipCondition Copy()
{
return new GacMembershipCondition();
}
public SecurityElement ToXml()
{
return ToXml( null );
}
public void FromXml( SecurityElement e )
{
FromXml( e, null );
}
public SecurityElement ToXml( PolicyLevel level )
{
SecurityElement root = new SecurityElement( "IMembershipCondition" );
System.Security.Util.XMLUtil.AddClassAttribute( root, this.GetType(), this.GetType().FullName );
root.AddAttribute( "version", "1" );
return root;
}
public void FromXml( SecurityElement e, PolicyLevel level )
{
if (e == null)
throw new ArgumentNullException("e");
if (!e.Tag.Equals( "IMembershipCondition" ))
throw new ArgumentException( Environment.GetResourceString( "Argument_MembershipConditionElement" ) );
}
public override bool Equals( Object o )
{
GacMembershipCondition that = (o as GacMembershipCondition);
if (that != null)
return true;
return false;
}
public override int GetHashCode()
{
return 0;
}
public override String ToString()
{
return Environment.GetResourceString( "GAC_ToString" );
}
}
}
// File provided for Reference Use Only by Microsoft Corporation (c) 2007.
Link Menu

This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- _AutoWebProxyScriptEngine.cs
- SerializationHelper.cs
- StringCollectionEditor.cs
- DataRowChangeEvent.cs
- MessageQueueEnumerator.cs
- SocketManager.cs
- AppDomainManager.cs
- MediaTimeline.cs
- versioninfo.cs
- PageThemeCodeDomTreeGenerator.cs
- WebPartZone.cs
- AppSettingsExpressionBuilder.cs
- ColorAnimationUsingKeyFrames.cs
- MultilineStringConverter.cs
- HttpContextServiceHost.cs
- TextDecorationCollection.cs
- GifBitmapEncoder.cs
- InvokeFunc.cs
- BindingWorker.cs
- ReadWriteSpinLock.cs
- EllipseGeometry.cs
- PrivateUnsafeNativeCompoundFileMethods.cs
- SimpleBitVector32.cs
- _CommandStream.cs
- IdentityHolder.cs
- BadImageFormatException.cs
- ViewCellRelation.cs
- PolicyLevel.cs
- SortDescription.cs
- DesignConnectionCollection.cs
- ConnectionManagementElementCollection.cs
- XamlSerializationHelper.cs
- Help.cs
- DataControlCommands.cs
- EncryptedPackageFilter.cs
- VarRemapper.cs
- DateTimeParse.cs
- SQLBytes.cs
- DataMisalignedException.cs
- ListViewItem.cs
- SafeRegistryHandle.cs
- RC2.cs
- Menu.cs
- Label.cs
- AssertFilter.cs
- Helper.cs
- UnmanagedBitmapWrapper.cs
- TaskForm.cs
- QualifiedId.cs
- GlyphTypeface.cs
- XPathNodeIterator.cs
- PTProvider.cs
- DbConnectionPoolOptions.cs
- FileDataSourceCache.cs
- TagMapCollection.cs
- WarningException.cs
- CredentialCache.cs
- MenuItemCollection.cs
- TimeoutValidationAttribute.cs
- PreservationFileReader.cs
- TabItemWrapperAutomationPeer.cs
- HtmlInputText.cs
- SecurityChannelListener.cs
- TemplateBindingExtension.cs
- LinearQuaternionKeyFrame.cs
- AsymmetricKeyExchangeFormatter.cs
- MenuCommands.cs
- DynamicResourceExtensionConverter.cs
- UnknownBitmapEncoder.cs
- RunClient.cs
- DesignerActionVerbList.cs
- DataViewManager.cs
- UserControl.cs
- TypeUtil.cs
- ParameterModifier.cs
- SslStream.cs
- Solver.cs
- SelectionEditor.cs
- Compiler.cs
- _ScatterGatherBuffers.cs
- EdmSchemaError.cs
- ObjectItemCachedAssemblyLoader.cs
- QilBinary.cs
- HandlerFactoryCache.cs
- IntellisenseTextBox.designer.cs
- ipaddressinformationcollection.cs
- Opcode.cs
- WmfPlaceableFileHeader.cs
- Rotation3DKeyFrameCollection.cs
- DrawingContextWalker.cs
- XmlNamedNodeMap.cs
- SoapInteropTypes.cs
- WindowCollection.cs
- OleDbWrapper.cs
- PointUtil.cs
- FixedSOMPageConstructor.cs
- Listen.cs
- HtmlEmptyTagControlBuilder.cs
- ActivityTypeResolver.xaml.cs
- DataGridItemEventArgs.cs