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
- FillRuleValidation.cs
- ResourceContainer.cs
- ManagementException.cs
- DataErrorValidationRule.cs
- VarRemapper.cs
- SrgsRule.cs
- WebPartDisplayModeCollection.cs
- InputReport.cs
- CheckedPointers.cs
- LinqDataView.cs
- WindowsListViewSubItem.cs
- QuadraticEase.cs
- HttpsChannelFactory.cs
- CodeSnippetStatement.cs
- LogManagementAsyncResult.cs
- CalculatedColumn.cs
- HtmlTableRow.cs
- sqlnorm.cs
- Baml2006ReaderSettings.cs
- XXXOnTypeBuilderInstantiation.cs
- ModifierKeysValueSerializer.cs
- ParallelRangeManager.cs
- WsatConfiguration.cs
- RangeValuePattern.cs
- Contracts.cs
- SizeAnimationUsingKeyFrames.cs
- XmlBindingWorker.cs
- columnmapkeybuilder.cs
- DeviceFilterDictionary.cs
- AuthenticationManager.cs
- StaticTextPointer.cs
- PropertyGridView.cs
- SafeNativeMethods.cs
- StreamWithDictionary.cs
- TypeKeyValue.cs
- XmlSchemaParticle.cs
- ProgressBar.cs
- TdsParameterSetter.cs
- Slider.cs
- MetadataCache.cs
- GridPatternIdentifiers.cs
- DataKey.cs
- NonSerializedAttribute.cs
- XmlName.cs
- WeakReference.cs
- XmlElementAttributes.cs
- XmlCompatibilityReader.cs
- Aes.cs
- RSAPKCS1KeyExchangeFormatter.cs
- KeyBinding.cs
- DebugView.cs
- ToolStripCustomTypeDescriptor.cs
- SymbolDocumentGenerator.cs
- WebControlsSection.cs
- XmlAtomicValue.cs
- SelectedGridItemChangedEvent.cs
- ObjectItemCollection.cs
- UnsafeNativeMethodsCLR.cs
- ToolStripSplitButton.cs
- ACE.cs
- OleDbFactory.cs
- PointCollection.cs
- DynamicObjectAccessor.cs
- LineSegment.cs
- HtmlForm.cs
- SourceLocation.cs
- CodeAttributeArgument.cs
- LocatorBase.cs
- MsmqProcessProtocolHandler.cs
- XsdValidatingReader.cs
- DataGridAutoGeneratingColumnEventArgs.cs
- ActivitySurrogateSelector.cs
- SparseMemoryStream.cs
- ToolStripItemRenderEventArgs.cs
- PropertyTabChangedEvent.cs
- TableLayoutColumnStyleCollection.cs
- SoapSchemaImporter.cs
- CheckableControlBaseAdapter.cs
- SafePEFileHandle.cs
- ThemeDictionaryExtension.cs
- PlanCompilerUtil.cs
- SpecularMaterial.cs
- DependencyPropertyKey.cs
- TargetParameterCountException.cs
- EditModeSwitchButton.cs
- TrackingServices.cs
- AttachmentService.cs
- Single.cs
- ErrorRuntimeConfig.cs
- TrustManagerPromptUI.cs
- DataGridViewDataConnection.cs
- SimpleWebHandlerParser.cs
- StopRoutingHandler.cs
- PersonalizationStateInfo.cs
- DataGridViewImageColumn.cs
- XMLSyntaxException.cs
- TemplateInstanceAttribute.cs
- TextBoxLine.cs
- UnsafeNativeMethods.cs
- glyphs.cs