Code:
/ DotNET / DotNET / 8.0 / untmp / WIN_WINDOWS / lh_tools_devdiv_wpf / Windows / wcp / Base / MS / Internal / IO / Packaging / PartManifestEntry.cs / 1 / PartManifestEntry.cs
//------------------------------------------------------------------------------ // //// Copyright (C) Microsoft Corporation. All rights reserved. // // // Description: // Simple struct for maintaining information of a Part found in an Xml signature manifest // // History: // 02/07/2005: [....]: Initial Implementation // 11/30/2005: [....]: Security Mitigations // //----------------------------------------------------------------------------- using System; using System.Diagnostics; using System.Collections.Generic; using System.Security.Cryptography; using System.Security.Cryptography.Xml; using System.Xml; using System.Windows; using System.IO.Packaging; using MS.Internal; namespace MS.Internal.IO.Packaging { ////// Represents parsed value for a single Part/Relationship entry in the Manifest /// internal struct PartManifestEntry { //----------------------------------------------------- // // Internal Properties // //----------------------------------------------------- // is this a relationship entry? internal bool IsRelationshipEntry { get { return _relationshipSelectors != null; } } internal Uri Uri { get { return _uri; } } internal ContentType ContentType { get { return _contentType; } } internal String HashAlgorithm { get { return _hashAlgorithm; } } internal String HashValue { get { return _hashValue; } } internal ListTransforms { get { return _transforms; } } internal List RelationshipSelectors { get { return _relationshipSelectors; } } // null if Part entry internal Uri OwningPartUri // only valid if IsRelationshipEntry { get { Debug.Assert(_owningPartUri != null, "Logic error: OwningPart is null on a non-Relationship entry"); return _owningPartUri; } } //------------------------------------------------------ // // Internal Methods // //----------------------------------------------------- /// /// Constructor /// /// part uri of part in question /// type of part /// digest method /// value of the hash calculation extracted from the signature Xml /// ordered transform list - may be null /// may be null but can never be empty internal PartManifestEntry(Uri uri, ContentType contentType, String hashAlgorithm, String hashValue, Listtransforms, List relationshipSelectors) { Invariant.Assert(uri != null); Invariant.Assert(contentType != null); Invariant.Assert(hashAlgorithm != null); _uri = uri; _contentType = contentType; _hashAlgorithm = hashAlgorithm; _hashValue = hashValue; _transforms = transforms; _relationshipSelectors = relationshipSelectors; _owningPartUri = null; if (_relationshipSelectors != null) { Invariant.Assert(relationshipSelectors.Count > 0); #if DEBUG Invariant.Assert(DoAllSelectorsHaveSameOwningPart(relationshipSelectors), "All relationship selectors should have same owningPart for a given part manifest"); #endif //Get owning Part uri from one of the relationship selectors _owningPartUri = relationshipSelectors[0].SourceUri; } } #if DEBUG private bool DoAllSelectorsHaveSameOwningPart(IEnumerable relationshipSelectors) { Uri owningPartUri = null; foreach (PackageRelationshipSelector selector in relationshipSelectors) { if (owningPartUri == null) { owningPartUri = selector.SourceUri; } else if (Uri.Compare(owningPartUri, selector.SourceUri, UriComponents.SerializationInfoString, UriFormat.UriEscaped, StringComparison.Ordinal) != 0 ) return false; } return true; } #endif //------------------------------------------------------ // // Private Fields // //------------------------------------------------------ private Uri _owningPartUri; // owing part if this is a Relationship Uri private Uri _uri; private ContentType _contentType; private String _hashAlgorithm; private String _hashValue; private List _transforms; private List _relationshipSelectors; // null if this is a Part } } // 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
- ScrollContentPresenter.cs
- ProfileEventArgs.cs
- DataServiceRequest.cs
- DataGridBoolColumn.cs
- ImmutablePropertyDescriptorGridEntry.cs
- UnsafeNetInfoNativeMethods.cs
- Registry.cs
- InstanceLockQueryResult.cs
- SqlDeflator.cs
- ParsedAttributeCollection.cs
- KeyValuePair.cs
- HttpHandlerActionCollection.cs
- FormViewDeletedEventArgs.cs
- Constants.cs
- AssemblyContextControlItem.cs
- ParameterModifier.cs
- DataGridViewColumnStateChangedEventArgs.cs
- WebPartMovingEventArgs.cs
- HtmlInputControl.cs
- ModelPerspective.cs
- IndependentAnimationStorage.cs
- OdbcConnectionOpen.cs
- Keywords.cs
- TrackingRecord.cs
- PlaceHolder.cs
- Canvas.cs
- MsmqIntegrationInputChannel.cs
- WebBrowserNavigatingEventHandler.cs
- HttpCapabilitiesBase.cs
- Automation.cs
- DataStreamFromComStream.cs
- DataGridViewTextBoxCell.cs
- DeferredReference.cs
- ListViewUpdateEventArgs.cs
- StringToken.cs
- TimerElapsedEvenArgs.cs
- InstanceCreationEditor.cs
- GeometryModel3D.cs
- XmlChoiceIdentifierAttribute.cs
- EntryWrittenEventArgs.cs
- DateTimeUtil.cs
- CompilerGlobalScopeAttribute.cs
- ControlBuilder.cs
- Odbc32.cs
- CipherData.cs
- DataServices.cs
- HttpConfigurationSystem.cs
- ToolStripDropDownClosingEventArgs.cs
- Regex.cs
- ClockController.cs
- DependencyPropertyAttribute.cs
- QuaternionAnimationBase.cs
- HttpRuntimeSection.cs
- DockingAttribute.cs
- TdsValueSetter.cs
- TraceContextRecord.cs
- StylusOverProperty.cs
- SqlInternalConnection.cs
- ImportContext.cs
- MulticastDelegate.cs
- NameSpaceExtractor.cs
- OdbcReferenceCollection.cs
- ProgramNode.cs
- DataStreams.cs
- DiscardableAttribute.cs
- NetworkInterface.cs
- XslAst.cs
- Trace.cs
- ActivityBindForm.cs
- AuthenticationServiceManager.cs
- DeviceContext.cs
- AccessDataSource.cs
- selecteditemcollection.cs
- IDispatchConstantAttribute.cs
- SourceChangedEventArgs.cs
- AffineTransform3D.cs
- UserUseLicenseDictionaryLoader.cs
- ZipIOExtraFieldZip64Element.cs
- CapabilitiesState.cs
- XPathException.cs
- ContentFilePart.cs
- HttpPostProtocolImporter.cs
- ProcessHostConfigUtils.cs
- SqlWebEventProvider.cs
- PersonalizableAttribute.cs
- InternalTypeHelper.cs
- MemoryPressure.cs
- InternalBufferManager.cs
- _Connection.cs
- SwitchLevelAttribute.cs
- DoubleLinkListEnumerator.cs
- DataGridCellAutomationPeer.cs
- ValidationRule.cs
- Fault.cs
- TabItem.cs
- Propagator.JoinPropagator.cs
- UniqueIdentifierService.cs
- CaseInsensitiveHashCodeProvider.cs
- GroupedContextMenuStrip.cs
- PenContext.cs