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
- CorrelationToken.cs
- XmlAnyElementAttribute.cs
- ModifierKeysValueSerializer.cs
- ComponentEditorForm.cs
- BlurBitmapEffect.cs
- AssemblySettingAttributes.cs
- XPathExpr.cs
- ThreadStartException.cs
- GridViewRowPresenterBase.cs
- ProtocolsConfigurationHandler.cs
- CodeAttributeDeclarationCollection.cs
- MultiView.cs
- DataGridItemEventArgs.cs
- WeakEventManager.cs
- ObjectStateManagerMetadata.cs
- EntitySqlException.cs
- XmlSchemaImporter.cs
- DataGridViewTopLeftHeaderCell.cs
- ProjectionPruner.cs
- RefreshEventArgs.cs
- EventMap.cs
- WindowsTokenRoleProvider.cs
- XamlVector3DCollectionSerializer.cs
- HttpFormatExtensions.cs
- FlowLayoutPanel.cs
- PixelShader.cs
- BoundsDrawingContextWalker.cs
- DefaultObjectMappingItemCollection.cs
- NameHandler.cs
- WorkflowQueuingService.cs
- ImportOptions.cs
- AdornerPresentationContext.cs
- AuthenticationConfig.cs
- ConnectionConsumerAttribute.cs
- VScrollBar.cs
- _CookieModule.cs
- WebPartConnectionsConnectVerb.cs
- SerializationStore.cs
- KnownBoxes.cs
- _HeaderInfoTable.cs
- ToolStripScrollButton.cs
- StatusBarItemAutomationPeer.cs
- MultiSelectRootGridEntry.cs
- IgnoreFileBuildProvider.cs
- DataControlButton.cs
- ISAPIApplicationHost.cs
- PriorityRange.cs
- SqlTrackingService.cs
- WebColorConverter.cs
- MissingSatelliteAssemblyException.cs
- FormClosedEvent.cs
- AmbientLight.cs
- ResourcesChangeInfo.cs
- ValueUnavailableException.cs
- GridViewCommandEventArgs.cs
- KeyboardEventArgs.cs
- TablePattern.cs
- FieldNameLookup.cs
- LinkLabel.cs
- InlineCollection.cs
- CodeExporter.cs
- EncodingFallbackAwareXmlTextWriter.cs
- Compilation.cs
- DataListItemEventArgs.cs
- ValueType.cs
- Decorator.cs
- StyleTypedPropertyAttribute.cs
- ListDictionary.cs
- SecureStringHasher.cs
- Base64Decoder.cs
- CodeFieldReferenceExpression.cs
- DataBoundControlDesigner.cs
- ConfigurationSectionCollection.cs
- MenuItem.cs
- WizardPanel.cs
- ItemsPresenter.cs
- MessageOperationFormatter.cs
- PermissionSetTriple.cs
- AtomEntry.cs
- BufferedGraphicsContext.cs
- QueueProcessor.cs
- GeometryModel3D.cs
- ForwardPositionQuery.cs
- ChannelManager.cs
- TraceHandler.cs
- Preprocessor.cs
- ResponseBodyWriter.cs
- latinshape.cs
- DeleteHelper.cs
- SqlConnectionPoolGroupProviderInfo.cs
- JournalEntry.cs
- IndicCharClassifier.cs
- CodeMemberEvent.cs
- FolderBrowserDialog.cs
- EndPoint.cs
- UInt16Storage.cs
- Point4DValueSerializer.cs
- KeyConstraint.cs
- CompareValidator.cs
- TableParagraph.cs