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
- NavigationProperty.cs
- CfgSemanticTag.cs
- AuthenticationModuleElement.cs
- DataGridViewCellValueEventArgs.cs
- PageVisual.cs
- SQLBinary.cs
- AutomationIdentifierGuids.cs
- AtomParser.cs
- NonSerializedAttribute.cs
- HttpResponseHeader.cs
- SkipStoryboardToFill.cs
- ModifyActivitiesPropertyDescriptor.cs
- BidirectionalDictionary.cs
- LocatorPart.cs
- FaultContractInfo.cs
- IdentifierCreationService.cs
- CalloutQueueItem.cs
- XPathNavigator.cs
- GridEntryCollection.cs
- FontDriver.cs
- ZipPackage.cs
- ThemeDictionaryExtension.cs
- DoubleConverter.cs
- LifetimeServices.cs
- HotSpot.cs
- Literal.cs
- ContractListAdapter.cs
- QueryContinueDragEvent.cs
- ComponentResourceKeyConverter.cs
- XhtmlBasicCalendarAdapter.cs
- MetadataSource.cs
- TableDesigner.cs
- OleDbRowUpdatedEvent.cs
- ChameleonKey.cs
- DataListItemCollection.cs
- NavigateUrlConverter.cs
- PropertyEmitter.cs
- AncillaryOps.cs
- ProjectionPruner.cs
- FixedSOMImage.cs
- TabControl.cs
- RuntimeCompatibilityAttribute.cs
- ConsoleTraceListener.cs
- ToolStripManager.cs
- VariableBinder.cs
- Pen.cs
- OdbcStatementHandle.cs
- VisualTreeUtils.cs
- TemplateControlBuildProvider.cs
- ObjectStateManagerMetadata.cs
- WebSysDefaultValueAttribute.cs
- DynamicScriptObject.cs
- SchemaTableOptionalColumn.cs
- Transform3D.cs
- SqlTransaction.cs
- WrappedIUnknown.cs
- QilInvokeLateBound.cs
- Item.cs
- TdsParserSessionPool.cs
- StateFinalizationDesigner.cs
- WebServiceMethodData.cs
- DecimalAnimationBase.cs
- SelectionProcessor.cs
- ExpandCollapsePattern.cs
- DifferencingCollection.cs
- CodeAssignStatement.cs
- ProviderConnectionPoint.cs
- TextEditorDragDrop.cs
- AliasedSlot.cs
- QilCloneVisitor.cs
- ConfigXmlSignificantWhitespace.cs
- XmlNamespaceMappingCollection.cs
- XmlValidatingReaderImpl.cs
- TextAction.cs
- ReadOnlyDataSource.cs
- PrefixHandle.cs
- XmlStreamStore.cs
- SemaphoreFullException.cs
- XmlSchemaAny.cs
- AccessText.cs
- AnnotationResourceCollection.cs
- ScrollData.cs
- DesignTimeTemplateParser.cs
- ResourceDescriptionAttribute.cs
- IIS7UserPrincipal.cs
- PictureBox.cs
- SR.cs
- ChangePasswordDesigner.cs
- ListViewPagedDataSource.cs
- DocumentReference.cs
- LinkLabelLinkClickedEvent.cs
- RemoteWebConfigurationHostServer.cs
- KnownTypeAttribute.cs
- IPGlobalProperties.cs
- BindingListCollectionView.cs
- GradientBrush.cs
- SymDocumentType.cs
- ObjectSecurity.cs
- RtfNavigator.cs
- TrustManagerMoreInformation.cs