Code:
/ WCF / WCF / 3.5.30729.1 / untmp / Orcas / SP / ndp / cdf / src / WCF / infocard / Client / System / IdentityModel / Selectors / PolicyChain.cs / 1 / PolicyChain.cs
//------------------------------------------------------------------------------ // Copyright (c) Microsoft Corporation. All rights reserved. //----------------------------------------------------------------------------- namespace System.IdentityModel.Selectors { using System; using System.Collections.Generic; using System.IO; using System.Runtime.InteropServices; using System.Text; using System.Xml; // // For common // using Microsoft.InfoCards; // // Summary: // This class wraps and manages the lifetime of an array of PolicyElements that are to be Marshaled to // native memory. // internal class PolicyChain : IDisposable { HGlobalSafeHandle m_nativeChain; InternalPolicyElement[] m_chain; public int Length { get { return m_chain.Length; } } public PolicyChain( CardSpacePolicyElement[ ] elements ) { int length = elements.Length; m_chain = new InternalPolicyElement[ length ]; for( int i = 0; i < length; i++ ) { m_chain[ i ] = new InternalPolicyElement( elements[ i ] ); } } public SafeHandle DoMarshal() { if( null == m_nativeChain ) { int elementSize = InternalPolicyElement.Size; int chainLength = m_chain.Length; m_nativeChain = HGlobalSafeHandle.Construct( chainLength * elementSize ); IntPtr pos = m_nativeChain.DangerousGetHandle(); foreach( InternalPolicyElement element in m_chain ) { element.DoMarshal( pos ); unsafe { // // All this just to do pos += elementSize // pos = new IntPtr( (long)( ( (ulong) pos.ToPointer() ) + (ulong) elementSize ) ); } } } return m_nativeChain; } public void Dispose() { Dispose( true ); } ~PolicyChain() { Dispose( false ); } private void Dispose( bool disposing ) { if( disposing ) { GC.SuppressFinalize( this ); } if( null != m_chain ) { foreach( InternalPolicyElement element in m_chain ) { if( null != element ) { element.Dispose(); } } m_chain = null; } if( null != m_nativeChain ) { m_nativeChain.Dispose(); } } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. // Copyright (c) Microsoft Corporation. All rights reserved.
Link Menu
This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- VariableAction.cs
- DesignTimeVisibleAttribute.cs
- TextPenaltyModule.cs
- SimpleTableProvider.cs
- DuplicateContext.cs
- HtmlTableCellCollection.cs
- PeerTransportListenAddressValidator.cs
- XmlSchemaSimpleContent.cs
- ByeMessageCD1.cs
- HtmlElement.cs
- GridViewRow.cs
- Error.cs
- XmlHierarchicalEnumerable.cs
- TextServicesProperty.cs
- propertyentry.cs
- FileLoadException.cs
- CookielessHelper.cs
- TextTreeTextElementNode.cs
- ProtocolImporter.cs
- GridEntryCollection.cs
- ProfilePropertySettings.cs
- Button.cs
- _NestedSingleAsyncResult.cs
- SigningProgress.cs
- ElementMarkupObject.cs
- Composition.cs
- Point3DCollection.cs
- WebBrowserProgressChangedEventHandler.cs
- Fault.cs
- PassportAuthenticationEventArgs.cs
- RootAction.cs
- BevelBitmapEffect.cs
- NullExtension.cs
- XmlSchemaRedefine.cs
- NestedContainer.cs
- GenericTypeParameterBuilder.cs
- PointAnimationUsingKeyFrames.cs
- PathGradientBrush.cs
- RepeaterItemEventArgs.cs
- EventHandlersStore.cs
- SerialErrors.cs
- RelationshipConverter.cs
- AnimationClockResource.cs
- TraceSwitch.cs
- TransformerTypeCollection.cs
- DbConnectionInternal.cs
- WinEventTracker.cs
- TemplatePropertyEntry.cs
- DocumentSchemaValidator.cs
- VersionedStreamOwner.cs
- FlowLayout.cs
- ShortcutKeysEditor.cs
- UnknownBitmapDecoder.cs
- ControlParameter.cs
- SaveFileDialog.cs
- DropDownList.cs
- dtdvalidator.cs
- _TimerThread.cs
- FlowLayoutSettings.cs
- WindowsGraphics.cs
- BatchStream.cs
- DiscoveryInnerClientAdhocCD1.cs
- ECDsaCng.cs
- FontCollection.cs
- TraceSection.cs
- AlternateViewCollection.cs
- OracleCommand.cs
- ItemDragEvent.cs
- ContentHostHelper.cs
- Matrix.cs
- TypeConverter.cs
- ListViewSortEventArgs.cs
- BitArray.cs
- InheritanceAttribute.cs
- RequestCache.cs
- Header.cs
- baseaxisquery.cs
- SuppressIldasmAttribute.cs
- StreamGeometry.cs
- ControlDesigner.cs
- IncrementalCompileAnalyzer.cs
- FormsAuthenticationCredentials.cs
- TypeConverter.cs
- AbstractDataSvcMapFileLoader.cs
- ComplexObject.cs
- GridViewPageEventArgs.cs
- ReadOnlyTernaryTree.cs
- BitmapEffectInputConnector.cs
- TabItemWrapperAutomationPeer.cs
- TakeOrSkipWhileQueryOperator.cs
- TdsParserHelperClasses.cs
- SerializationFieldInfo.cs
- DataKey.cs
- SurrogateEncoder.cs
- StylusSystemGestureEventArgs.cs
- CellCreator.cs
- InfoCardSymmetricCrypto.cs
- InheritanceAttribute.cs
- UnsafeNativeMethods.cs
- FlowLayoutPanel.cs