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
- SqlDataSourceConfigureFilterForm.cs
- DebugTracing.cs
- SyndicationDeserializer.cs
- log.cs
- DesignerAttributeInfo.cs
- StructuredType.cs
- PersonalizationEntry.cs
- MostlySingletonList.cs
- RequestValidator.cs
- SecUtil.cs
- RunWorkerCompletedEventArgs.cs
- Double.cs
- ContextMenu.cs
- Pair.cs
- VisualStyleRenderer.cs
- RbTree.cs
- MessageRpc.cs
- RunInstallerAttribute.cs
- SafeTimerHandle.cs
- TrackingServices.cs
- Track.cs
- TextMetrics.cs
- IdentityHolder.cs
- InputLanguageManager.cs
- ToolBarButtonDesigner.cs
- FixedTextSelectionProcessor.cs
- TTSEngineProxy.cs
- HttpConfigurationSystem.cs
- BaseCodePageEncoding.cs
- CacheModeValueSerializer.cs
- AudioFileOut.cs
- DataKeyCollection.cs
- ParallelEnumerableWrapper.cs
- InfoCardTrace.cs
- OleDbWrapper.cs
- RecipientIdentity.cs
- NetworkAddressChange.cs
- JsonDeserializer.cs
- New.cs
- AttachedPropertyBrowsableAttribute.cs
- KeyedCollection.cs
- Context.cs
- ControlParameter.cs
- CompositionCommandSet.cs
- MatrixTransform3D.cs
- FontSourceCollection.cs
- AuthorizationContext.cs
- HttpModuleCollection.cs
- Style.cs
- SecurityAppliedMessage.cs
- cookie.cs
- WinCategoryAttribute.cs
- XmlSchemaSimpleTypeUnion.cs
- LinqDataSourceStatusEventArgs.cs
- ResourceExpressionEditor.cs
- XmlSchemaComplexType.cs
- ItemType.cs
- Base64WriteStateInfo.cs
- ResourceProviderFactory.cs
- PrintDialog.cs
- PrivateFontCollection.cs
- ipaddressinformationcollection.cs
- LeaseManager.cs
- DocumentPaginator.cs
- RelativeSource.cs
- AQNBuilder.cs
- ListView.cs
- HttpCapabilitiesEvaluator.cs
- Baml2006ReaderContext.cs
- ControlPaint.cs
- QueuePropertyVariants.cs
- OutputCacheSettingsSection.cs
- VerificationAttribute.cs
- RuleSetCollection.cs
- ParentUndoUnit.cs
- QilLoop.cs
- SynchronizedInputPattern.cs
- FreezableDefaultValueFactory.cs
- HtmlTableRowCollection.cs
- DataPagerFieldCollection.cs
- TransformGroup.cs
- QueryResponse.cs
- WebBrowserEvent.cs
- ClipboardProcessor.cs
- WebPartEditVerb.cs
- PopOutPanel.cs
- CurrentChangedEventManager.cs
- ControlBuilder.cs
- PcmConverter.cs
- WebPartDescriptionCollection.cs
- XmlIlVisitor.cs
- InkCanvasInnerCanvas.cs
- MetaChildrenColumn.cs
- CreateUserWizard.cs
- AssociationEndMember.cs
- ServicePoint.cs
- ExtentJoinTreeNode.cs
- ResponseBodyWriter.cs
- ConditionalDesigner.cs
- ToolStripItemCollection.cs