Code:
/ Dotnetfx_Vista_SP2 / Dotnetfx_Vista_SP2 / 8.0.50727.4016 / DEVDIV / depot / DevDiv / releases / whidbey / NetFxQFE / 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
- RegexStringValidatorAttribute.cs
- QilCloneVisitor.cs
- Calendar.cs
- PersianCalendar.cs
- SlipBehavior.cs
- TextProperties.cs
- MaskedTextProvider.cs
- EDesignUtil.cs
- LoadRetryHandler.cs
- DesignTimeType.cs
- ObjectListSelectEventArgs.cs
- HiddenField.cs
- WindowManager.cs
- PasswordRecovery.cs
- _UriTypeConverter.cs
- TabItemAutomationPeer.cs
- Array.cs
- Logging.cs
- WindowsToolbarAsMenu.cs
- TypeBuilder.cs
- TextViewSelectionProcessor.cs
- SpellerStatusTable.cs
- SqlBulkCopyColumnMappingCollection.cs
- NCryptSafeHandles.cs
- Viewport2DVisual3D.cs
- RSACryptoServiceProvider.cs
- NamespaceCollection.cs
- RightsManagementUser.cs
- SimpleHandlerBuildProvider.cs
- Roles.cs
- MbpInfo.cs
- CmsInterop.cs
- BufferModeSettings.cs
- Ipv6Element.cs
- InternalEnumValidatorAttribute.cs
- DragCompletedEventArgs.cs
- FileIOPermission.cs
- InstanceKeyCompleteException.cs
- DebugInfo.cs
- CachedTypeface.cs
- BlobPersonalizationState.cs
- CapacityStreamGeometryContext.cs
- Transactions.cs
- SiteMapProvider.cs
- Size.cs
- CharacterBufferReference.cs
- AnnotationElement.cs
- DecoderNLS.cs
- ping.cs
- ReadOnlyPermissionSet.cs
- WindowsEditBox.cs
- TextDecorationUnitValidation.cs
- AppDomainAttributes.cs
- DesignerAutoFormatCollection.cs
- D3DImage.cs
- ServiceModelStringsVersion1.cs
- DispatcherHooks.cs
- GenericUI.cs
- HttpContextWrapper.cs
- DesignerDataConnection.cs
- SettingsProperty.cs
- ObjectTokenCategory.cs
- SourceFileBuildProvider.cs
- DataFormat.cs
- Schema.cs
- ObjectAnimationUsingKeyFrames.cs
- XmlEncoding.cs
- DynamicMethod.cs
- ImageMapEventArgs.cs
- SymLanguageVendor.cs
- SmtpTransport.cs
- ObjectTag.cs
- BoundingRectTracker.cs
- InstanceHandleReference.cs
- ControlPaint.cs
- SoapSchemaImporter.cs
- ClassGenerator.cs
- ActivityDesignerHelper.cs
- QilStrConcat.cs
- RoutedEventValueSerializer.cs
- EnvironmentPermission.cs
- DataBindingList.cs
- GrabHandleGlyph.cs
- StreamingContext.cs
- ChangeInterceptorAttribute.cs
- MsmqHostedTransportManager.cs
- CodeConstructor.cs
- X509PeerCertificateAuthentication.cs
- ColumnMapVisitor.cs
- FileDialog.cs
- AnnotationResourceCollection.cs
- CultureSpecificStringDictionary.cs
- EmptyImpersonationContext.cs
- AsyncStreamReader.cs
- CodeDomExtensionMethods.cs
- ResolveNameEventArgs.cs
- ContextInformation.cs
- SafeNativeMethods.cs
- InsufficientMemoryException.cs
- HtmlInputRadioButton.cs