Code:
/ 4.0 / 4.0 / untmp / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / cdf / src / NetFx40 / XamlBuildTask / Microsoft / Build / Tasks / Xaml / WrappingXamlSchemaContext.cs / 1305376 / WrappingXamlSchemaContext.cs
using System; using System.Collections.Generic; using System.Text; using System.Xaml; using System.Reflection; namespace Microsoft.Build.Tasks.Xaml { class XamlNsReplacingContext : XamlSchemaContext { string localAssemblyName; string realAssemblyName; IDictionaryMasterTypeList; public XamlNsReplacingContext(IEnumerable referenceAssemblies, string localAssemblyName, string realAssemblyName) : base(referenceAssemblies) { this.localAssemblyName = localAssemblyName; this.realAssemblyName = realAssemblyName; MasterTypeList = new Dictionary (); } public override XamlType GetXamlType(Type type) { if (type == null) { throw FxTrace.Exception.AsError(new ArgumentNullException("type")); } XamlNsReplacingType xamlType = null; if (!MasterTypeList.TryGetValue(type, out xamlType)) { xamlType = new XamlNsReplacingType(type, this, localAssemblyName, realAssemblyName); MasterTypeList.Add(type, xamlType); } return xamlType; } protected override XamlType GetXamlType(string xamlNamespace, string name, params XamlType[] typeArguments) { XamlType xamlType = base.GetXamlType(xamlNamespace, name, typeArguments); if (xamlType == null || xamlType.IsUnknown) { xamlNamespace = XamlBuildTaskServices.UpdateClrNamespaceUriWithLocalAssembly(xamlNamespace, this.localAssemblyName, this.realAssemblyName); xamlType = base.GetXamlType(xamlNamespace, name, typeArguments); } return xamlType; } } class XamlNsReplacingType : XamlType { string localAssemblyName; string realAssemblyName; List namespaces; public XamlNsReplacingType(Type underlyingType, XamlSchemaContext context, string localAssemblyName, string realAssemblyName) : base(underlyingType, context) { this.localAssemblyName = localAssemblyName; this.realAssemblyName = realAssemblyName; namespaces = null; } public override IList GetXamlNamespaces() { if (namespaces == null) { namespaces = new List (); IList originalNamespaces = base.GetXamlNamespaces(); foreach (var ns in originalNamespaces) { namespaces.Add(XamlBuildTaskServices.UpdateClrNamespaceUriWithLocalAssembly(ns, this.localAssemblyName, this.realAssemblyName)); } } return namespaces; } } } // 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
- MyContact.cs
- SocketCache.cs
- BorderGapMaskConverter.cs
- TraceContextRecord.cs
- TextSelectionHighlightLayer.cs
- SqlDataSourceQueryConverter.cs
- ToolStripPanel.cs
- RadioButton.cs
- login.cs
- EntityDataSource.cs
- ReadOnlyHierarchicalDataSource.cs
- AudioException.cs
- WpfXamlLoader.cs
- MarkupCompilePass2.cs
- X509RawDataKeyIdentifierClause.cs
- GenericsNotImplementedException.cs
- AVElementHelper.cs
- IApplicationTrustManager.cs
- XmlChildEnumerator.cs
- MsmqProcessProtocolHandler.cs
- ChannelOptions.cs
- SecurityTokenSerializer.cs
- UserControl.cs
- SoapIgnoreAttribute.cs
- SoapSchemaImporter.cs
- SAPICategories.cs
- SessionPageStateSection.cs
- ClientSponsor.cs
- SurrogateChar.cs
- WorkflowInvoker.cs
- Viewport3DAutomationPeer.cs
- MenuItemCollection.cs
- SoapExtensionImporter.cs
- EventLogEntryCollection.cs
- VisualBasicSettingsHandler.cs
- contentDescriptor.cs
- TaskFactory.cs
- EventLogPermissionEntryCollection.cs
- SoapCodeExporter.cs
- DataKeyCollection.cs
- BreadCrumbTextConverter.cs
- CqlQuery.cs
- UserValidatedEventArgs.cs
- ZipIOExtraField.cs
- SqlInternalConnectionSmi.cs
- Misc.cs
- CheckableControlBaseAdapter.cs
- InvalidateEvent.cs
- DesignerHost.cs
- ByteStreamGeometryContext.cs
- HtmlToClrEventProxy.cs
- PrtTicket_Base.cs
- GacUtil.cs
- _NativeSSPI.cs
- SecurityVerifiedMessage.cs
- HashRepartitionEnumerator.cs
- ModuleBuilderData.cs
- HtmlControlAdapter.cs
- CodeAccessPermission.cs
- TableHeaderCell.cs
- UnsafeNativeMethods.cs
- XmlObjectSerializerReadContextComplexJson.cs
- FileDetails.cs
- AxisAngleRotation3D.cs
- OleStrCAMarshaler.cs
- GenericsInstances.cs
- ColumnMapTranslator.cs
- PathSegment.cs
- Interlocked.cs
- UnsafeNativeMethods.cs
- GridViewSortEventArgs.cs
- SafeEventLogReadHandle.cs
- ImageMapEventArgs.cs
- CompositeFontParser.cs
- ProxyWebPartManager.cs
- ThicknessAnimationBase.cs
- ExtendedProtectionPolicy.cs
- BehaviorService.cs
- XPathDocumentIterator.cs
- StreamedFramingRequestChannel.cs
- SafeIUnknown.cs
- XmlSchemaObject.cs
- dataobject.cs
- TouchesOverProperty.cs
- OperationCanceledException.cs
- CoreSwitches.cs
- NetDataContractSerializer.cs
- Dynamic.cs
- SafeArrayTypeMismatchException.cs
- OdbcParameterCollection.cs
- ButtonBase.cs
- ReferencedCollectionType.cs
- DebugTraceHelper.cs
- ListDataBindEventArgs.cs
- ModelTreeEnumerator.cs
- AdPostCacheSubstitution.cs
- RuleSetReference.cs
- CollectionEditorDialog.cs
- MenuItemCollection.cs
- TextContainerChangedEventArgs.cs