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
- TemplatePartAttribute.cs
- SqlBuilder.cs
- ManagementDateTime.cs
- CommentEmitter.cs
- SqlCommandSet.cs
- ConfigurationSectionCollection.cs
- Comparer.cs
- DotExpr.cs
- CannotUnloadAppDomainException.cs
- Comparer.cs
- MetadataUtil.cs
- wgx_commands.cs
- CharacterMetrics.cs
- ListCollectionView.cs
- MetaModel.cs
- OutputCacheSection.cs
- TrackPointCollection.cs
- BitmapEffectGroup.cs
- AuthenticationServiceManager.cs
- PageClientProxyGenerator.cs
- XmlKeywords.cs
- LambdaCompiler.Statements.cs
- PngBitmapEncoder.cs
- ContentElementAutomationPeer.cs
- TreeViewHitTestInfo.cs
- ServiceDescriptionReflector.cs
- ErrorFormatterPage.cs
- WsatRegistrationHeader.cs
- WebPartDeleteVerb.cs
- EventHandlerList.cs
- CaretElement.cs
- BuildProviderCollection.cs
- CryptoApi.cs
- StringWriter.cs
- RecognizerBase.cs
- OdbcError.cs
- TraceSection.cs
- SystemIcons.cs
- DatagridviewDisplayedBandsData.cs
- GifBitmapEncoder.cs
- TraceHandlerErrorFormatter.cs
- SystemWebCachingSectionGroup.cs
- PointHitTestResult.cs
- TrailingSpaceComparer.cs
- OleDbConnection.cs
- translator.cs
- MethodRental.cs
- RawStylusActions.cs
- WrappedKeySecurityTokenParameters.cs
- ClaimSet.cs
- SortDescriptionCollection.cs
- DataSetMappper.cs
- DefaultValueAttribute.cs
- XsdValidatingReader.cs
- SortedList.cs
- ContentHostHelper.cs
- AuthorizationRule.cs
- MultiAsyncResult.cs
- DataRelationCollection.cs
- DataGridViewRowDividerDoubleClickEventArgs.cs
- HttpCachePolicyElement.cs
- QueryValue.cs
- ScrollProviderWrapper.cs
- PropertyInfo.cs
- XamlSerializerUtil.cs
- FormatSettings.cs
- DesignerAutoFormat.cs
- IResourceProvider.cs
- CornerRadiusConverter.cs
- CellCreator.cs
- ErrorWebPart.cs
- GlyphRun.cs
- ObfuscationAttribute.cs
- ColorConvertedBitmap.cs
- WindowsFormsHelpers.cs
- ParsedAttributeCollection.cs
- PreProcessInputEventArgs.cs
- TableDesigner.cs
- LazyTextWriterCreator.cs
- DrawingBrush.cs
- FormViewInsertedEventArgs.cs
- OAVariantLib.cs
- AtomPub10ServiceDocumentFormatter.cs
- RepeatInfo.cs
- XmlMembersMapping.cs
- CodeVariableReferenceExpression.cs
- PriorityItem.cs
- LinkedResourceCollection.cs
- UriTemplateMatchException.cs
- OciLobLocator.cs
- _ContextAwareResult.cs
- OptimalBreakSession.cs
- SessionStateModule.cs
- GrammarBuilderRuleRef.cs
- InheritanceRules.cs
- TreeNodeBinding.cs
- BufferedWebEventProvider.cs
- TreeBuilderXamlTranslator.cs
- NavigationService.cs
- BuildProvidersCompiler.cs