Code:
/ Dotnetfx_Vista_SP2 / Dotnetfx_Vista_SP2 / 8.0.50727.4016 / DEVDIV / depot / DevDiv / releases / Orcas / QFE / wpf / src / Framework / MS / Internal / AppModel / MimeObjectFactory.cs / 1 / MimeObjectFactory.cs
//------------------------------------------------------------------------------ // //// Copyright (C) Microsoft Corporation. All rights reserved. // // // Description: // Provides a set of static methods for transforming pairs of // mime type + stream into objects. // // History: // 11/11/2004: Erichar: Initial creation. // //----------------------------------------------------------------------------- using System; using System.Windows; using System.IO; using System.Collections.Generic; using MS.Internal.Utility; using System.Diagnostics; using System.Globalization; using System.Windows.Markup; namespace MS.Internal.AppModel { internal delegate object StreamToObjectFactoryDelegate(Stream s, Uri baseUri, bool canUseTopLevelBrowser, bool sandboxExternalContent, bool allowAsync, bool isJournalNavigation, out XamlReader asyncObjectConverter); internal static class MimeObjectFactory { //----------------------------------------------------- // // Internal Static Methods // //----------------------------------------------------- #region internal static methods // The delegate that we are calling is responsible for closing the stream internal static object GetObjectAndCloseStream(Stream s, ContentType contentType, Uri baseUri, bool canUseTopLevelBrowser, bool sandboxExternalContent, bool allowAsync, bool isJournalNavigation, out XamlReader asyncObjectConverter) { object objToReturn = null; asyncObjectConverter = null; if (contentType != null) { StreamToObjectFactoryDelegate d; if (_objectConverters.TryGetValue(contentType, out d)) { objToReturn = d(s, baseUri, canUseTopLevelBrowser, sandboxExternalContent, allowAsync, isJournalNavigation, out asyncObjectConverter); } } return objToReturn; } // The delegate registered here will be responsible for closing the stream passed to it. internal static void Register(ContentType contentType, StreamToObjectFactoryDelegate method) { _objectConverters[contentType] = method; } #endregion //------------------------------------------------------ // // Private Members // //----------------------------------------------------- #region private members private static readonly Dictionary_objectConverters = new Dictionary (5, new ContentType.WeakComparer()); #endregion } } // 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: // Provides a set of static methods for transforming pairs of // mime type + stream into objects. // // History: // 11/11/2004: Erichar: Initial creation. // //----------------------------------------------------------------------------- using System; using System.Windows; using System.IO; using System.Collections.Generic; using MS.Internal.Utility; using System.Diagnostics; using System.Globalization; using System.Windows.Markup; namespace MS.Internal.AppModel { internal delegate object StreamToObjectFactoryDelegate(Stream s, Uri baseUri, bool canUseTopLevelBrowser, bool sandboxExternalContent, bool allowAsync, bool isJournalNavigation, out XamlReader asyncObjectConverter); internal static class MimeObjectFactory { //----------------------------------------------------- // // Internal Static Methods // //----------------------------------------------------- #region internal static methods // The delegate that we are calling is responsible for closing the stream internal static object GetObjectAndCloseStream(Stream s, ContentType contentType, Uri baseUri, bool canUseTopLevelBrowser, bool sandboxExternalContent, bool allowAsync, bool isJournalNavigation, out XamlReader asyncObjectConverter) { object objToReturn = null; asyncObjectConverter = null; if (contentType != null) { StreamToObjectFactoryDelegate d; if (_objectConverters.TryGetValue(contentType, out d)) { objToReturn = d(s, baseUri, canUseTopLevelBrowser, sandboxExternalContent, allowAsync, isJournalNavigation, out asyncObjectConverter); } } return objToReturn; } // The delegate registered here will be responsible for closing the stream passed to it. internal static void Register(ContentType contentType, StreamToObjectFactoryDelegate method) { _objectConverters[contentType] = method; } #endregion //------------------------------------------------------ // // Private Members // //----------------------------------------------------- #region private members private static readonly Dictionary_objectConverters = new Dictionary (5, new ContentType.WeakComparer()); #endregion } } // 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
- ItemAutomationPeer.cs
- CheckBoxStandardAdapter.cs
- RecognitionResult.cs
- RecognizerInfo.cs
- BoolExpr.cs
- mda.cs
- CheckBoxDesigner.cs
- FormViewPagerRow.cs
- WinEventWrap.cs
- SafeRightsManagementQueryHandle.cs
- ValueTypeFixupInfo.cs
- DllNotFoundException.cs
- XmlQueryRuntime.cs
- FormViewDeleteEventArgs.cs
- XmlDeclaration.cs
- UInt64.cs
- Pkcs9Attribute.cs
- _DomainName.cs
- EdmPropertyAttribute.cs
- IndexedEnumerable.cs
- clipboard.cs
- LinqDataSourceContextEventArgs.cs
- PropertyValueChangedEvent.cs
- StructuredTypeInfo.cs
- TreeViewImageKeyConverter.cs
- DependencyStoreSurrogate.cs
- CheckedPointers.cs
- ApplicationSecurityInfo.cs
- WizardPanelChangingEventArgs.cs
- InternalSafeNativeMethods.cs
- WebCategoryAttribute.cs
- WriterOutput.cs
- ValidationError.cs
- QilIterator.cs
- MobileControl.cs
- BoolExpressionVisitors.cs
- VoiceSynthesis.cs
- WrappedIUnknown.cs
- SynchronizationContextHelper.cs
- ImageInfo.cs
- BooleanAnimationUsingKeyFrames.cs
- Hyperlink.cs
- ExpressionBuilderCollection.cs
- InstanceStoreQueryResult.cs
- SqlRecordBuffer.cs
- XmlSerializerVersionAttribute.cs
- OracleBinary.cs
- FreezableCollection.cs
- BaseTemplatedMobileComponentEditor.cs
- MessageTransmitTraceRecord.cs
- CodeLinePragma.cs
- MouseGesture.cs
- ImageButton.cs
- BitSet.cs
- SerTrace.cs
- MediaCommands.cs
- LocalizableAttribute.cs
- XmlHierarchyData.cs
- TypeUnloadedException.cs
- TimeSpan.cs
- iisPickupDirectory.cs
- DoubleAnimationUsingPath.cs
- ClientSession.cs
- Page.cs
- Metadata.cs
- InternalCache.cs
- CommentEmitter.cs
- WizardStepCollectionEditor.cs
- ExpressionLexer.cs
- DropSource.cs
- DataControlFieldCollection.cs
- FormsAuthenticationConfiguration.cs
- Console.cs
- FieldToken.cs
- SerializationSectionGroup.cs
- StorageComplexTypeMapping.cs
- TemplateColumn.cs
- CaseCqlBlock.cs
- DataGridViewToolTip.cs
- ByteConverter.cs
- BaseHashHelper.cs
- VirtualizedItemProviderWrapper.cs
- UnsafeNativeMethods.cs
- SortQueryOperator.cs
- SqlColumnizer.cs
- PerformanceCounterPermissionEntry.cs
- MailWebEventProvider.cs
- AnnotationResource.cs
- ComponentCommands.cs
- SmiEventStream.cs
- bindurihelper.cs
- EqualityComparer.cs
- PeerFlooder.cs
- AuthorizationRule.cs
- GlyphRunDrawing.cs
- TextViewSelectionProcessor.cs
- ModelUIElement3D.cs
- SafeCloseHandleCritical.cs
- ListSourceHelper.cs
- IntPtr.cs