Code:
/ 4.0 / 4.0 / 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. 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; IDictionary MasterTypeList; 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
- CharacterMetricsDictionary.cs
- ExceptionHandler.cs
- CodeParameterDeclarationExpressionCollection.cs
- ThemeDictionaryExtension.cs
- SqlParameterCollection.cs
- ItemMap.cs
- ListBox.cs
- EntityDataSourceChangingEventArgs.cs
- TypedReference.cs
- Lease.cs
- SqlDataSourceEnumerator.cs
- NumericUpDown.cs
- PkcsUtils.cs
- CultureInfo.cs
- ObjectSet.cs
- DetailsViewUpdatedEventArgs.cs
- FilteredDataSetHelper.cs
- ExceptionHandlers.cs
- PeerToPeerException.cs
- LinkClickEvent.cs
- CharUnicodeInfo.cs
- FunctionUpdateCommand.cs
- DirectoryInfo.cs
- ServiceSettingsResponseInfo.cs
- DictionaryContent.cs
- CompareInfo.cs
- LoginView.cs
- BufferBuilder.cs
- Underline.cs
- TextTrailingCharacterEllipsis.cs
- DrawingContextWalker.cs
- CodeExpressionRuleDeclaration.cs
- ToolstripProfessionalRenderer.cs
- CodeBlockBuilder.cs
- DataSourceUtil.cs
- ControlTemplate.cs
- PcmConverter.cs
- StandardBindingReliableSessionElement.cs
- DynamicQueryableWrapper.cs
- KnownIds.cs
- Msmq.cs
- UpdatePanel.cs
- CryptographicAttribute.cs
- ContextActivityUtils.cs
- StylusEditingBehavior.cs
- GridViewUpdatedEventArgs.cs
- AggregateNode.cs
- DocumentSequence.cs
- UIElementIsland.cs
- Debug.cs
- SolidBrush.cs
- EditorZone.cs
- TextModifierScope.cs
- ToolboxItemCollection.cs
- ExpressionList.cs
- QuerySettings.cs
- BrushValueSerializer.cs
- ServiceHttpHandlerFactory.cs
- SafeNativeMethods.cs
- FieldNameLookup.cs
- MDIControlStrip.cs
- TableLayoutStyle.cs
- SmtpClient.cs
- CommandBinding.cs
- GenericTypeParameterConverter.cs
- XmlSchemaGroup.cs
- DataGridViewCellStyleContentChangedEventArgs.cs
- DateTimeStorage.cs
- GPStream.cs
- HttpRuntime.cs
- TableRowGroup.cs
- ToolStripDropTargetManager.cs
- unitconverter.cs
- PriorityBinding.cs
- ProtocolViolationException.cs
- URIFormatException.cs
- NumberFormatInfo.cs
- SymmetricCryptoHandle.cs
- GradientStop.cs
- DataPagerFieldCommandEventArgs.cs
- _NegotiateClient.cs
- CategoryAttribute.cs
- RemoteArgument.cs
- CustomMenuItemCollection.cs
- AutomationProperties.cs
- EntitySqlQueryBuilder.cs
- XXXInfos.cs
- infer.cs
- _ConnectStream.cs
- EventToken.cs
- GridViewUpdatedEventArgs.cs
- SQLInt16Storage.cs
- CacheAxisQuery.cs
- DrawingAttributesDefaultValueFactory.cs
- ObjectDataSourceStatusEventArgs.cs
- PropertyGeneratedEventArgs.cs
- ToolStripDropDownClosingEventArgs.cs
- SingleTagSectionHandler.cs
- AccessDataSource.cs
- MetadataCache.cs