Code:
/ Dotnetfx_Vista_SP2 / Dotnetfx_Vista_SP2 / 8.0.50727.4016 / DEVDIV / depot / DevDiv / releases / whidbey / NetFxQFE / ndp / fx / src / security / system / security / permissions / storepermissionattribute.cs / 1 / storepermissionattribute.cs
// ==++==
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
// ==--==
//
// StorePermissionAttribute.cs
//
namespace System.Security.Permissions {
[AttributeUsage(AttributeTargets.Method | AttributeTargets.Constructor | AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Assembly, AllowMultiple = true, Inherited = false )]
[Serializable()]
public sealed class StorePermissionAttribute : CodeAccessSecurityAttribute {
StorePermissionFlags m_flags = StorePermissionFlags.NoFlags;
public StorePermissionAttribute(SecurityAction action) : base(action) {}
public StorePermissionFlags Flags {
get { return m_flags; }
set {
StorePermission.VerifyFlags(value);
m_flags = value;
}
}
public bool CreateStore {
get { return (m_flags & StorePermissionFlags.CreateStore) != 0; }
set { m_flags = value ? m_flags | StorePermissionFlags.CreateStore : m_flags & ~StorePermissionFlags.CreateStore; }
}
public bool DeleteStore {
get { return (m_flags & StorePermissionFlags.DeleteStore) != 0; }
set { m_flags = value ? m_flags | StorePermissionFlags.DeleteStore : m_flags & ~StorePermissionFlags.DeleteStore; }
}
public bool EnumerateStores {
get { return (m_flags & StorePermissionFlags.EnumerateStores) != 0; }
set { m_flags = value ? m_flags | StorePermissionFlags.EnumerateStores : m_flags & ~StorePermissionFlags.EnumerateStores; }
}
public bool OpenStore {
get { return (m_flags & StorePermissionFlags.OpenStore) != 0; }
set { m_flags = value ? m_flags | StorePermissionFlags.OpenStore : m_flags & ~StorePermissionFlags.OpenStore; }
}
public bool AddToStore {
get { return (m_flags & StorePermissionFlags.AddToStore) != 0; }
set { m_flags = value ? m_flags | StorePermissionFlags.AddToStore : m_flags & ~StorePermissionFlags.AddToStore; }
}
public bool RemoveFromStore {
get { return (m_flags & StorePermissionFlags.RemoveFromStore) != 0; }
set { m_flags = value ? m_flags | StorePermissionFlags.RemoveFromStore : m_flags & ~StorePermissionFlags.RemoveFromStore; }
}
public bool EnumerateCertificates {
get { return (m_flags & StorePermissionFlags.EnumerateCertificates) != 0; }
set { m_flags = value ? m_flags | StorePermissionFlags.EnumerateCertificates : m_flags & ~StorePermissionFlags.EnumerateCertificates; }
}
public override IPermission CreatePermission() {
if (Unrestricted)
return new StorePermission(PermissionState.Unrestricted);
else
return new StorePermission(m_flags);
}
}
}
// File provided for Reference Use Only by Microsoft Corporation (c) 2007.
// ==++==
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
// ==--==
//
// StorePermissionAttribute.cs
//
namespace System.Security.Permissions {
[AttributeUsage(AttributeTargets.Method | AttributeTargets.Constructor | AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Assembly, AllowMultiple = true, Inherited = false )]
[Serializable()]
public sealed class StorePermissionAttribute : CodeAccessSecurityAttribute {
StorePermissionFlags m_flags = StorePermissionFlags.NoFlags;
public StorePermissionAttribute(SecurityAction action) : base(action) {}
public StorePermissionFlags Flags {
get { return m_flags; }
set {
StorePermission.VerifyFlags(value);
m_flags = value;
}
}
public bool CreateStore {
get { return (m_flags & StorePermissionFlags.CreateStore) != 0; }
set { m_flags = value ? m_flags | StorePermissionFlags.CreateStore : m_flags & ~StorePermissionFlags.CreateStore; }
}
public bool DeleteStore {
get { return (m_flags & StorePermissionFlags.DeleteStore) != 0; }
set { m_flags = value ? m_flags | StorePermissionFlags.DeleteStore : m_flags & ~StorePermissionFlags.DeleteStore; }
}
public bool EnumerateStores {
get { return (m_flags & StorePermissionFlags.EnumerateStores) != 0; }
set { m_flags = value ? m_flags | StorePermissionFlags.EnumerateStores : m_flags & ~StorePermissionFlags.EnumerateStores; }
}
public bool OpenStore {
get { return (m_flags & StorePermissionFlags.OpenStore) != 0; }
set { m_flags = value ? m_flags | StorePermissionFlags.OpenStore : m_flags & ~StorePermissionFlags.OpenStore; }
}
public bool AddToStore {
get { return (m_flags & StorePermissionFlags.AddToStore) != 0; }
set { m_flags = value ? m_flags | StorePermissionFlags.AddToStore : m_flags & ~StorePermissionFlags.AddToStore; }
}
public bool RemoveFromStore {
get { return (m_flags & StorePermissionFlags.RemoveFromStore) != 0; }
set { m_flags = value ? m_flags | StorePermissionFlags.RemoveFromStore : m_flags & ~StorePermissionFlags.RemoveFromStore; }
}
public bool EnumerateCertificates {
get { return (m_flags & StorePermissionFlags.EnumerateCertificates) != 0; }
set { m_flags = value ? m_flags | StorePermissionFlags.EnumerateCertificates : m_flags & ~StorePermissionFlags.EnumerateCertificates; }
}
public override IPermission CreatePermission() {
if (Unrestricted)
return new StorePermission(PermissionState.Unrestricted);
else
return new StorePermission(m_flags);
}
}
}
// 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
- FtpCachePolicyElement.cs
- OperatingSystem.cs
- ComboBoxItem.cs
- EndEvent.cs
- TextFindEngine.cs
- TrackBarRenderer.cs
- TCPClient.cs
- Matrix3D.cs
- IApplicationTrustManager.cs
- GACMembershipCondition.cs
- TranslateTransform.cs
- ValidationErrorEventArgs.cs
- PropertyTabChangedEvent.cs
- SmiSettersStream.cs
- CredentialCache.cs
- StringValidatorAttribute.cs
- CreateUserWizard.cs
- ListSourceHelper.cs
- ThemeInfoAttribute.cs
- COSERVERINFO.cs
- OrderedHashRepartitionStream.cs
- BehaviorEditorPart.cs
- ApplicationContext.cs
- AspCompat.cs
- COM2AboutBoxPropertyDescriptor.cs
- CalendarDesigner.cs
- XdrBuilder.cs
- TextTreeInsertElementUndoUnit.cs
- ZoneMembershipCondition.cs
- SqlRetyper.cs
- FilterQuery.cs
- XmlComplianceUtil.cs
- ManifestResourceInfo.cs
- TiffBitmapDecoder.cs
- UniqueEventHelper.cs
- StringAnimationUsingKeyFrames.cs
- PopupControlService.cs
- SpellerStatusTable.cs
- SizeConverter.cs
- TraceRecord.cs
- OdbcDataReader.cs
- TableLayout.cs
- TraceHandler.cs
- DependencyPropertyDescriptor.cs
- _LocalDataStore.cs
- ServerIdentity.cs
- Size.cs
- MenuCommand.cs
- CodeIdentifier.cs
- UrlMappingCollection.cs
- CustomValidator.cs
- CryptoApi.cs
- ZipIOCentralDirectoryDigitalSignature.cs
- DescriptionAttribute.cs
- ProviderCommandInfoUtils.cs
- Menu.cs
- RowParagraph.cs
- WorkflowDefinitionContext.cs
- ItemChangedEventArgs.cs
- LocationSectionRecord.cs
- WmlCalendarAdapter.cs
- ContentFilePart.cs
- SqlDependencyUtils.cs
- WsdlWriter.cs
- ViewEvent.cs
- WebPartVerbCollection.cs
- RootAction.cs
- LazyInitializer.cs
- PhysicalFontFamily.cs
- Timer.cs
- UInt32Storage.cs
- RuleSettings.cs
- BamlReader.cs
- SafeBitVector32.cs
- NewItemsContextMenuStrip.cs
- AttachedPropertyMethodSelector.cs
- BinaryObjectReader.cs
- SerializationStore.cs
- ResourceDefaultValueAttribute.cs
- CacheSection.cs
- TransmissionStrategy.cs
- MaterialGroup.cs
- ColorMap.cs
- DataBindingValueUIHandler.cs
- MarkupCompiler.cs
- XmlSchemaChoice.cs
- Path.cs
- DeobfuscatingStream.cs
- RegisterInfo.cs
- ChineseLunisolarCalendar.cs
- TagPrefixInfo.cs
- mansign.cs
- RuntimeCompatibilityAttribute.cs
- PixelShader.cs
- HtmlInputRadioButton.cs
- HttpRequest.cs
- WeakRefEnumerator.cs
- WebConfigurationManager.cs
- CollectionMarkupSerializer.cs
- BitVector32.cs