Code:
/ 4.0 / 4.0 / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / fx / src / security / system / security / authentication / ExtendedProtection / ExtendedProtectionPolicyTypeConverter.cs / 1305376 / ExtendedProtectionPolicyTypeConverter.cs
//------------------------------------------------------------------------------ // // Copyright (c) Microsoft Corporation. All rights reserved. // //----------------------------------------------------------------------------- using System; using System.Collections; using System.ComponentModel; using System.ComponentModel.Design.Serialization; using System.Globalization; using System.Reflection; namespace System.Security.Authentication.ExtendedProtection { public class ExtendedProtectionPolicyTypeConverter : TypeConverter { public override bool CanConvertTo(ITypeDescriptorContext context, Type destinationType) { if (destinationType == typeof(InstanceDescriptor)) { return true; } return base.CanConvertTo(context, destinationType); } public override object ConvertTo(ITypeDescriptorContext context, CultureInfo culture, object value, Type destinationType) { if (destinationType == typeof(InstanceDescriptor)) { ExtendedProtectionPolicy policy = value as ExtendedProtectionPolicy; if (policy != null) { Type[] parameterTypes; object[] parameterValues; if (policy.PolicyEnforcement == PolicyEnforcement.Never) { parameterTypes = new Type[] { typeof(PolicyEnforcement) }; parameterValues = new object[] { PolicyEnforcement.Never }; } else { parameterTypes = new Type[] { typeof(PolicyEnforcement), typeof(ProtectionScenario), typeof(ICollection) }; object[] customServiceNames = null; if (policy.CustomServiceNames != null && policy.CustomServiceNames.Count > 0) { customServiceNames = new object[policy.CustomServiceNames.Count]; ((ICollection)policy.CustomServiceNames).CopyTo(customServiceNames, 0); } parameterValues = new object[] { policy.PolicyEnforcement, policy.ProtectionScenario, customServiceNames }; } ConstructorInfo constructor = typeof(ExtendedProtectionPolicy).GetConstructor(parameterTypes); return new InstanceDescriptor(constructor, parameterValues); } } return base.ConvertTo(context, culture, value, destinationType); } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. //------------------------------------------------------------------------------ // // Copyright (c) Microsoft Corporation. All rights reserved. // //----------------------------------------------------------------------------- using System; using System.Collections; using System.ComponentModel; using System.ComponentModel.Design.Serialization; using System.Globalization; using System.Reflection; namespace System.Security.Authentication.ExtendedProtection { public class ExtendedProtectionPolicyTypeConverter : TypeConverter { public override bool CanConvertTo(ITypeDescriptorContext context, Type destinationType) { if (destinationType == typeof(InstanceDescriptor)) { return true; } return base.CanConvertTo(context, destinationType); } public override object ConvertTo(ITypeDescriptorContext context, CultureInfo culture, object value, Type destinationType) { if (destinationType == typeof(InstanceDescriptor)) { ExtendedProtectionPolicy policy = value as ExtendedProtectionPolicy; if (policy != null) { Type[] parameterTypes; object[] parameterValues; if (policy.PolicyEnforcement == PolicyEnforcement.Never) { parameterTypes = new Type[] { typeof(PolicyEnforcement) }; parameterValues = new object[] { PolicyEnforcement.Never }; } else { parameterTypes = new Type[] { typeof(PolicyEnforcement), typeof(ProtectionScenario), typeof(ICollection) }; object[] customServiceNames = null; if (policy.CustomServiceNames != null && policy.CustomServiceNames.Count > 0) { customServiceNames = new object[policy.CustomServiceNames.Count]; ((ICollection)policy.CustomServiceNames).CopyTo(customServiceNames, 0); } parameterValues = new object[] { policy.PolicyEnforcement, policy.ProtectionScenario, customServiceNames }; } ConstructorInfo constructor = typeof(ExtendedProtectionPolicy).GetConstructor(parameterTypes); return new InstanceDescriptor(constructor, parameterValues); } } return base.ConvertTo(context, culture, value, destinationType); } } } // 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
- ApplicationException.cs
- SelectionEditor.cs
- BaseAutoFormat.cs
- DataBindingExpressionBuilder.cs
- TableAutomationPeer.cs
- TextTrailingCharacterEllipsis.cs
- CanonicalXml.cs
- StylusPointPropertyId.cs
- TransformedBitmap.cs
- ThreadLocal.cs
- StagingAreaInputItem.cs
- _SpnDictionary.cs
- ChtmlMobileTextWriter.cs
- RoutedUICommand.cs
- SamlAttribute.cs
- Helpers.cs
- HttpModule.cs
- GacUtil.cs
- NetworkStream.cs
- SiteOfOriginPart.cs
- SqlPersonalizationProvider.cs
- SelectionRange.cs
- DesignUtil.cs
- RelationHandler.cs
- coordinatorscratchpad.cs
- NamedPipeChannelListener.cs
- WizardStepBase.cs
- Exceptions.cs
- OledbConnectionStringbuilder.cs
- ClientSponsor.cs
- CacheChildrenQuery.cs
- XmlComment.cs
- PhysicalAddress.cs
- NotifyCollectionChangedEventArgs.cs
- MulticastDelegate.cs
- CodeEntryPointMethod.cs
- ViewPort3D.cs
- RepeatBehavior.cs
- RadioButton.cs
- ClientSettingsStore.cs
- ClassicBorderDecorator.cs
- SpeakProgressEventArgs.cs
- BindingEditor.xaml.cs
- DLinqAssociationProvider.cs
- UInt32.cs
- Point3DCollectionValueSerializer.cs
- ImageSource.cs
- EndpointInfo.cs
- AdCreatedEventArgs.cs
- MatrixTransform3D.cs
- XmlILModule.cs
- _emptywebproxy.cs
- StyleHelper.cs
- PrimaryKeyTypeConverter.cs
- StringValidator.cs
- FilterFactory.cs
- DigitalSignature.cs
- UriTemplateMatch.cs
- XmlSignatureProperties.cs
- Vector3DKeyFrameCollection.cs
- SamlAssertion.cs
- Int64.cs
- externdll.cs
- File.cs
- Atom10FormatterFactory.cs
- XmlSchemas.cs
- TreeNodeEventArgs.cs
- DotNetATv1WindowsLogEntryDeserializer.cs
- OuterGlowBitmapEffect.cs
- CommonDialog.cs
- XsdBuildProvider.cs
- HtmlLinkAdapter.cs
- CornerRadiusConverter.cs
- XslCompiledTransform.cs
- FusionWrap.cs
- QueryPageSettingsEventArgs.cs
- ClassValidator.cs
- SourceInterpreter.cs
- IPGlobalProperties.cs
- Point3DCollectionConverter.cs
- ContainerUIElement3D.cs
- CustomError.cs
- ProjectionCamera.cs
- DataGridViewCellValidatingEventArgs.cs
- OperationAbortedException.cs
- XmlEntity.cs
- X509Extension.cs
- CollectionChangedEventManager.cs
- GradientStop.cs
- PerfCounters.cs
- SortedSet.cs
- GridView.cs
- ExtensionFile.cs
- OdbcReferenceCollection.cs
- Comparer.cs
- RedBlackList.cs
- SocketInformation.cs
- ScrollBar.cs
- ConstraintStruct.cs
- FlowDecision.cs