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
- SoapEnvelopeProcessingElement.cs
- NameTable.cs
- RtfControls.cs
- TripleDES.cs
- OciLobLocator.cs
- configsystem.cs
- StringConverter.cs
- TypeConstant.cs
- FrameworkReadOnlyPropertyMetadata.cs
- RefreshEventArgs.cs
- NotSupportedException.cs
- AdCreatedEventArgs.cs
- VectorValueSerializer.cs
- HotSpotCollection.cs
- SqlBulkCopy.cs
- MobileControlsSection.cs
- Int32Collection.cs
- PropertyGeneratedEventArgs.cs
- OperationBehaviorAttribute.cs
- GraphicsContainer.cs
- ImageSourceConverter.cs
- ObjectQueryExecutionPlan.cs
- XmlComplianceUtil.cs
- DbProviderFactoriesConfigurationHandler.cs
- UnicastIPAddressInformationCollection.cs
- StyleBamlRecordReader.cs
- PrimitiveSchema.cs
- WebSysDescriptionAttribute.cs
- CalloutQueueItem.cs
- FlowNode.cs
- TdsValueSetter.cs
- ManagedIStream.cs
- DrawTreeNodeEventArgs.cs
- DbCommandTree.cs
- ValueTypeFixupInfo.cs
- ProcessManager.cs
- Site.cs
- DiscoveryDefaults.cs
- AssociationType.cs
- XpsFilter.cs
- FrameworkReadOnlyPropertyMetadata.cs
- UrlPath.cs
- MulticastNotSupportedException.cs
- WebBrowserContainer.cs
- SafeFileMapViewHandle.cs
- QueryContinueDragEvent.cs
- DataRelationPropertyDescriptor.cs
- MemberRelationshipService.cs
- MeasureData.cs
- MimeParameters.cs
- InvalidComObjectException.cs
- XamlStyleSerializer.cs
- FactoryGenerator.cs
- DataGridViewTextBoxEditingControl.cs
- AddInAttribute.cs
- XPathArrayIterator.cs
- CheckBoxBaseAdapter.cs
- _ConnectStream.cs
- DatatypeImplementation.cs
- ArraySet.cs
- PerfService.cs
- NegationPusher.cs
- MarkupWriter.cs
- SystemTcpStatistics.cs
- SecUtil.cs
- COM2ComponentEditor.cs
- ExpressionCopier.cs
- DataViewManager.cs
- Token.cs
- XamlSerializerUtil.cs
- Int32RectValueSerializer.cs
- ImpersonationContext.cs
- ToolStripDropDownItemDesigner.cs
- ColumnResult.cs
- WindowsStreamSecurityElement.cs
- FormatterConverter.cs
- SpotLight.cs
- SingleConverter.cs
- AutomationFocusChangedEventArgs.cs
- OperationResponse.cs
- DataGridViewRowConverter.cs
- ImplicitInputBrush.cs
- KnownAssemblyEntry.cs
- StylusButtonCollection.cs
- StaticSiteMapProvider.cs
- GB18030Encoding.cs
- MetadataWorkspace.cs
- CheckedListBox.cs
- DuplicateWaitObjectException.cs
- OdbcConnectionOpen.cs
- ByteKeyFrameCollection.cs
- StaticExtension.cs
- ICollection.cs
- ProfileGroupSettings.cs
- Utilities.cs
- _LazyAsyncResult.cs
- TemplateAction.cs
- TrackBar.cs
- HtmlTernaryTree.cs
- MLangCodePageEncoding.cs