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
- QueryStringConverter.cs
- ActivationServices.cs
- ProtocolInformationWriter.cs
- HttpListenerRequest.cs
- MimeTypePropertyAttribute.cs
- WebPartVerbsEventArgs.cs
- ParserContext.cs
- BitHelper.cs
- HostingEnvironmentException.cs
- ExpandoObject.cs
- FixedPageProcessor.cs
- BaseParser.cs
- LookupNode.cs
- DBCSCodePageEncoding.cs
- StateRuntime.cs
- TreeNodeStyle.cs
- ExpressionList.cs
- ListViewItemMouseHoverEvent.cs
- TextChange.cs
- DataBoundControlHelper.cs
- ping.cs
- _ProxyRegBlob.cs
- EventMappingSettingsCollection.cs
- DirectoryObjectSecurity.cs
- IPEndPoint.cs
- XmlText.cs
- XmlSchemaFacet.cs
- AvtEvent.cs
- ClusterSafeNativeMethods.cs
- GridItemPatternIdentifiers.cs
- MemberMaps.cs
- DataControlField.cs
- ComponentResourceManager.cs
- SqlBinder.cs
- UriTemplateTrieNode.cs
- InternalConfigHost.cs
- FieldDescriptor.cs
- XPathQilFactory.cs
- SqlDataReaderSmi.cs
- WebPartEditorApplyVerb.cs
- XmlDataFileEditor.cs
- Mouse.cs
- ConfigurationValidatorBase.cs
- SmtpCommands.cs
- _ConnectStream.cs
- FillErrorEventArgs.cs
- QilInvoke.cs
- TCPClient.cs
- FunctionDescription.cs
- SessionSwitchEventArgs.cs
- CriticalFinalizerObject.cs
- WindowsGrip.cs
- securitymgrsite.cs
- CodeGenerator.cs
- ExceptionRoutedEventArgs.cs
- ObjectContextServiceProvider.cs
- EdmError.cs
- Literal.cs
- HttpException.cs
- wpf-etw.cs
- DynamicPropertyReader.cs
- ShaderEffect.cs
- X509CertificateValidator.cs
- BitmapEffectInputData.cs
- CacheMemory.cs
- RequestSecurityToken.cs
- TextParagraph.cs
- EncoderExceptionFallback.cs
- Rijndael.cs
- MaskDesignerDialog.cs
- LateBoundBitmapDecoder.cs
- NonBatchDirectoryCompiler.cs
- COMException.cs
- ValidationManager.cs
- OutArgument.cs
- PrintDialogDesigner.cs
- SortAction.cs
- TimelineCollection.cs
- KeyValueSerializer.cs
- SchemaElement.cs
- MenuEventArgs.cs
- DataGridViewMethods.cs
- CodeNamespaceImport.cs
- HwndProxyElementProvider.cs
- PrintPreviewGraphics.cs
- ScaleTransform.cs
- XmlCharCheckingReader.cs
- ComponentEditorForm.cs
- CodeSubDirectoriesCollection.cs
- ErrorEventArgs.cs
- XPathSingletonIterator.cs
- WebPartDeleteVerb.cs
- HttpCachePolicy.cs
- SecurityContextTokenValidationException.cs
- SimpleModelProvider.cs
- DataGridViewCellMouseEventArgs.cs
- WebBrowserHelper.cs
- TailPinnedEventArgs.cs
- XmlSchemaNotation.cs
- OleDbRowUpdatingEvent.cs