Code:
/ Dotnetfx_Win7_3.5.1 / Dotnetfx_Win7_3.5.1 / 3.5.1 / DEVDIV / depot / DevDiv / releases / Orcas / NetFXw7 / wpf / src / 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: BruceMac: Initial Implementation // 11/30/2005: BruceMac: 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. //------------------------------------------------------------------------------ // // // 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: BruceMac: Initial Implementation // 11/30/2005: BruceMac: 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
- Size3DValueSerializer.cs
- DetailsViewModeEventArgs.cs
- ConstrainedDataObject.cs
- EntityCommandCompilationException.cs
- HelpProvider.cs
- WindowsListViewGroupSubsetLink.cs
- EpmSyndicationContentSerializer.cs
- DebuggerAttributes.cs
- PermissionAttributes.cs
- WebPartConnectionsConfigureVerb.cs
- SafeNativeMethods.cs
- AssemblyBuilder.cs
- InputQueue.cs
- ExtensionWindowResizeGrip.cs
- ResolveCriteriaApril2005.cs
- XPathNavigator.cs
- keycontainerpermission.cs
- CustomSignedXml.cs
- ImagingCache.cs
- XsltCompileContext.cs
- _Rfc2616CacheValidators.cs
- XamlReader.cs
- TableLayoutRowStyleCollection.cs
- RayMeshGeometry3DHitTestResult.cs
- ObjectTag.cs
- PreviewPageInfo.cs
- ConnectionStringSettings.cs
- MutexSecurity.cs
- XmlUtil.cs
- Debug.cs
- XmlSchemaValidator.cs
- SettingsPropertyWrongTypeException.cs
- SqlConnectionString.cs
- listitem.cs
- AngleUtil.cs
- DataKey.cs
- SpecularMaterial.cs
- XmlnsDefinitionAttribute.cs
- FlowDocumentScrollViewerAutomationPeer.cs
- ModelTypeConverter.cs
- CapabilitiesPattern.cs
- smtpconnection.cs
- DataGridTableStyleMappingNameEditor.cs
- MoveSizeWinEventHandler.cs
- PageAsyncTaskManager.cs
- SerializableAuthorizationContext.cs
- QueryCacheKey.cs
- GridViewCellAutomationPeer.cs
- ThreadInterruptedException.cs
- Membership.cs
- DataBoundControlAdapter.cs
- LogAppendAsyncResult.cs
- WebPartManagerInternals.cs
- CallSiteOps.cs
- __Filters.cs
- BaseTemplateBuildProvider.cs
- Base64Encoder.cs
- HttpVersion.cs
- Emitter.cs
- MaterialGroup.cs
- SvcMapFile.cs
- SecurityToken.cs
- Operand.cs
- ServicePointManagerElement.cs
- PrivilegeNotHeldException.cs
- ResourceKey.cs
- DecoderReplacementFallback.cs
- InertiaExpansionBehavior.cs
- DataControlFieldCell.cs
- ExtractorMetadata.cs
- SID.cs
- HtmlFormParameterReader.cs
- IListConverters.cs
- RestHandlerFactory.cs
- Calendar.cs
- RuntimeConfigLKG.cs
- WeakReference.cs
- SignatureToken.cs
- ArrayTypeMismatchException.cs
- DesignerToolStripControlHost.cs
- TriggerActionCollection.cs
- Int32AnimationBase.cs
- Decorator.cs
- SiteMapPath.cs
- CqlWriter.cs
- DataGridViewRowConverter.cs
- ComboBoxRenderer.cs
- FormView.cs
- SchemeSettingElementCollection.cs
- LassoHelper.cs
- ISCIIEncoding.cs
- StreamResourceInfo.cs
- ElementsClipboardData.cs
- MULTI_QI.cs
- FontClient.cs
- SqlMethodCallConverter.cs
- ActivitiesCollection.cs
- Helper.cs
- StringUtil.cs
- SizeAnimationBase.cs