Code:
/ Net / Net / 3.5.50727.3053 / DEVDIV / depot / DevDiv / releases / whidbey / netfxsp / ndp / clr / src / BCL / System / Security / Permissions / GACIdentityPermission.cs / 1 / GACIdentityPermission.cs
// ==++== // // Copyright (c) Microsoft Corporation. All rights reserved. // // ==--== // GacIdentityPermission.cs // namespace System.Security.Permissions { using System; using SecurityElement = System.Security.SecurityElement; using System.Globalization; [AttributeUsage(AttributeTargets.Method | AttributeTargets.Constructor | AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Assembly, AllowMultiple = true, Inherited = false )] [System.Runtime.InteropServices.ComVisible(true)] [Serializable()] sealed public class GacIdentityPermissionAttribute : CodeAccessSecurityAttribute { public GacIdentityPermissionAttribute( SecurityAction action ) : base( action ) { } public override IPermission CreatePermission() { return new GacIdentityPermission(); } } [System.Runtime.InteropServices.ComVisible(true)] [Serializable()] sealed public class GacIdentityPermission : CodeAccessPermission, IBuiltInPermission { //------------------------------------------------------ // // PUBLIC CONSTRUCTORS // //----------------------------------------------------- public GacIdentityPermission(PermissionState state) { if (state == PermissionState.Unrestricted) { if(!CodeAccessSecurityEngine.DoesFullTrustMeanFullTrust()) throw new ArgumentException(Environment.GetResourceString("Argument_UnrestrictedIdentityPermission")); } else if (state == PermissionState.None) { } else { throw new ArgumentException(Environment.GetResourceString("Argument_InvalidPermissionState")); } } public GacIdentityPermission() { } //----------------------------------------------------- // // IPERMISSION IMPLEMENTATION // //----------------------------------------------------- public override IPermission Copy() { return new GacIdentityPermission(); } public override bool IsSubsetOf(IPermission target) { if (target == null) return false; if (!(target is GacIdentityPermission)) throw new ArgumentException(String.Format(CultureInfo.CurrentCulture, Environment.GetResourceString("Argument_WrongType"), this.GetType().FullName)); return true; } public override IPermission Intersect(IPermission target) { if (target == null) return null; if (!(target is GacIdentityPermission)) throw new ArgumentException(String.Format(CultureInfo.CurrentCulture, Environment.GetResourceString("Argument_WrongType"), this.GetType().FullName)); return this.Copy(); } public override IPermission Union(IPermission target) { if (target == null) return this.Copy(); if (!(target is GacIdentityPermission)) throw new ArgumentException(String.Format(CultureInfo.CurrentCulture, Environment.GetResourceString("Argument_WrongType"), this.GetType().FullName)); return this.Copy(); } public override SecurityElement ToXml() { SecurityElement securityElement = CodeAccessPermission.CreatePermissionElement( this, "System.Security.Permissions.GacIdentityPermission" ); return securityElement; } public override void FromXml(SecurityElement securityElement) { CodeAccessPermission.ValidateElement(securityElement, this); } ///int IBuiltInPermission.GetTokenIndex() { return GacIdentityPermission.GetTokenIndex(); } internal static int GetTokenIndex() { return BuiltInPermissionIndex.GacIdentityPermissionIndex; } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. // ==++== // // Copyright (c) Microsoft Corporation. All rights reserved. // // ==--== // GacIdentityPermission.cs // namespace System.Security.Permissions { using System; using SecurityElement = System.Security.SecurityElement; using System.Globalization; [AttributeUsage(AttributeTargets.Method | AttributeTargets.Constructor | AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Assembly, AllowMultiple = true, Inherited = false )] [System.Runtime.InteropServices.ComVisible(true)] [Serializable()] sealed public class GacIdentityPermissionAttribute : CodeAccessSecurityAttribute { public GacIdentityPermissionAttribute( SecurityAction action ) : base( action ) { } public override IPermission CreatePermission() { return new GacIdentityPermission(); } } [System.Runtime.InteropServices.ComVisible(true)] [Serializable()] sealed public class GacIdentityPermission : CodeAccessPermission, IBuiltInPermission { //------------------------------------------------------ // // PUBLIC CONSTRUCTORS // //----------------------------------------------------- public GacIdentityPermission(PermissionState state) { if (state == PermissionState.Unrestricted) { if(!CodeAccessSecurityEngine.DoesFullTrustMeanFullTrust()) throw new ArgumentException(Environment.GetResourceString("Argument_UnrestrictedIdentityPermission")); } else if (state == PermissionState.None) { } else { throw new ArgumentException(Environment.GetResourceString("Argument_InvalidPermissionState")); } } public GacIdentityPermission() { } //----------------------------------------------------- // // IPERMISSION IMPLEMENTATION // //----------------------------------------------------- public override IPermission Copy() { return new GacIdentityPermission(); } public override bool IsSubsetOf(IPermission target) { if (target == null) return false; if (!(target is GacIdentityPermission)) throw new ArgumentException(String.Format(CultureInfo.CurrentCulture, Environment.GetResourceString("Argument_WrongType"), this.GetType().FullName)); return true; } public override IPermission Intersect(IPermission target) { if (target == null) return null; if (!(target is GacIdentityPermission)) throw new ArgumentException(String.Format(CultureInfo.CurrentCulture, Environment.GetResourceString("Argument_WrongType"), this.GetType().FullName)); return this.Copy(); } public override IPermission Union(IPermission target) { if (target == null) return this.Copy(); if (!(target is GacIdentityPermission)) throw new ArgumentException(String.Format(CultureInfo.CurrentCulture, Environment.GetResourceString("Argument_WrongType"), this.GetType().FullName)); return this.Copy(); } public override SecurityElement ToXml() { SecurityElement securityElement = CodeAccessPermission.CreatePermissionElement( this, "System.Security.Permissions.GacIdentityPermission" ); return securityElement; } public override void FromXml(SecurityElement securityElement) { CodeAccessPermission.ValidateElement(securityElement, this); } /// int IBuiltInPermission.GetTokenIndex() { return GacIdentityPermission.GetTokenIndex(); } internal static int GetTokenIndex() { return BuiltInPermissionIndex.GacIdentityPermissionIndex; } } } // 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
- Relationship.cs
- SessionStateSection.cs
- basenumberconverter.cs
- ConfigurationManager.cs
- GrammarBuilder.cs
- DataGridSortingEventArgs.cs
- EventSinkHelperWriter.cs
- OracleEncoding.cs
- CultureNotFoundException.cs
- BulletChrome.cs
- ListViewSortEventArgs.cs
- ModelPerspective.cs
- StateBag.cs
- QueryOutputWriter.cs
- _ListenerAsyncResult.cs
- ConfigXmlText.cs
- NullableBoolConverter.cs
- XmlLanguageConverter.cs
- KeyPullup.cs
- SerializableAttribute.cs
- IISMapPath.cs
- MobileErrorInfo.cs
- TypeFieldSchema.cs
- ToolStripDesignerUtils.cs
- CodeStatementCollection.cs
- CustomError.cs
- GiveFeedbackEvent.cs
- OpenFileDialog.cs
- ResolveCompletedEventArgs.cs
- RuntimeComponentFilter.cs
- ConnectionManager.cs
- DynamicDocumentPaginator.cs
- ApplicationId.cs
- StatusBarPanelClickEvent.cs
- MouseBinding.cs
- MarkerProperties.cs
- BinaryVersion.cs
- ReadonlyMessageFilter.cs
- ScopelessEnumAttribute.cs
- ActiveDocumentEvent.cs
- StylusEventArgs.cs
- WindowsFormsSynchronizationContext.cs
- ProcessStartInfo.cs
- BaseCAMarshaler.cs
- ImportContext.cs
- CustomPopupPlacement.cs
- Section.cs
- WebBrowserBase.cs
- Triangle.cs
- figurelength.cs
- ConfigurationLocationCollection.cs
- SymmetricCryptoHandle.cs
- CompleteWizardStep.cs
- Decimal.cs
- FlowDocumentView.cs
- PackageStore.cs
- ListItemViewAttribute.cs
- StrokeSerializer.cs
- ObjectRef.cs
- ToolStripLabel.cs
- Token.cs
- SqlCrossApplyToCrossJoin.cs
- BuilderElements.cs
- PageRequestManager.cs
- StorageMappingItemCollection.cs
- TouchPoint.cs
- HashHelper.cs
- Translator.cs
- CheckBoxFlatAdapter.cs
- WebException.cs
- Encoder.cs
- OnOperation.cs
- TrackingValidationObjectDictionary.cs
- Rect3D.cs
- Codec.cs
- MonikerUtility.cs
- WebEventTraceProvider.cs
- WsdlBuildProvider.cs
- TypeForwardedToAttribute.cs
- PropertyItem.cs
- CallbackHandler.cs
- PenLineJoinValidation.cs
- ConsumerConnectionPoint.cs
- JpegBitmapDecoder.cs
- Input.cs
- SafeArchiveContext.cs
- MtomMessageEncoder.cs
- DataMemberListEditor.cs
- FontConverter.cs
- DefaultSettingsSection.cs
- FontSource.cs
- AffineTransform3D.cs
- AccessDataSourceView.cs
- TableCell.cs
- XmlSchemaComplexContentRestriction.cs
- NamedPipeTransportBindingElement.cs
- EntityDataReader.cs
- SplineKeyFrames.cs
- SelectorAutomationPeer.cs
- Helpers.cs