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
- AutomationEventArgs.cs
- NetworkInformationException.cs
- AncillaryOps.cs
- AspNetPartialTrustHelpers.cs
- Matrix3DConverter.cs
- CodeConstructor.cs
- FirstMatchCodeGroup.cs
- Win32Interop.cs
- DictionaryBase.cs
- WebConfigurationHost.cs
- MatrixTransform.cs
- Guid.cs
- TableMethodGenerator.cs
- ProviderSettings.cs
- CaretElement.cs
- CompressEmulationStream.cs
- Typography.cs
- BookmarkWorkItem.cs
- UnionCodeGroup.cs
- ProcessDesigner.cs
- VBIdentifierDesigner.xaml.cs
- Compilation.cs
- TTSEvent.cs
- SafeFileMapViewHandle.cs
- TableCellCollection.cs
- WhileDesigner.xaml.cs
- FloaterParagraph.cs
- ErrorTableItemStyle.cs
- DescendentsWalkerBase.cs
- SystemBrushes.cs
- TextContainerChangeEventArgs.cs
- XomlCompilerError.cs
- QueryInterceptorAttribute.cs
- FormattedTextSymbols.cs
- ParserHooks.cs
- MetadataFile.cs
- XmlJsonReader.cs
- TableLayout.cs
- Table.cs
- CompositeDataBoundControl.cs
- DPCustomTypeDescriptor.cs
- SqlDataSource.cs
- DeviceContext2.cs
- TokenBasedSetEnumerator.cs
- TableRowCollection.cs
- DefaultValueAttribute.cs
- CmsInterop.cs
- ProfileService.cs
- DesignerActionPanel.cs
- SystemWebExtensionsSectionGroup.cs
- JoinTreeSlot.cs
- COM2PictureConverter.cs
- securitycriticaldata.cs
- DataGridColumnEventArgs.cs
- ListBindableAttribute.cs
- ConfigurationManager.cs
- InstanceValue.cs
- SettingsSection.cs
- RuleSetCollection.cs
- BindableTemplateBuilder.cs
- SimplePropertyEntry.cs
- QilStrConcatenator.cs
- ScrollEventArgs.cs
- ArithmeticException.cs
- ServicesUtilities.cs
- DataGridViewUtilities.cs
- SqlWebEventProvider.cs
- RemotingConfiguration.cs
- TypeRestriction.cs
- SqlDataSourceWizardForm.cs
- MediaPlayerState.cs
- Renderer.cs
- Tag.cs
- Rfc2898DeriveBytes.cs
- followingsibling.cs
- MetadataPropertyCollection.cs
- SerializationEventsCache.cs
- SatelliteContractVersionAttribute.cs
- InputLanguageManager.cs
- RuleSetDialog.Designer.cs
- EpmSyndicationContentSerializer.cs
- DataGridViewLinkCell.cs
- TextTreeFixupNode.cs
- DocumentPage.cs
- OverflowException.cs
- RSAPKCS1KeyExchangeDeformatter.cs
- Enlistment.cs
- DesignTimeResourceProviderFactoryAttribute.cs
- ResourcePermissionBaseEntry.cs
- SearchForVirtualItemEventArgs.cs
- IApplicationTrustManager.cs
- ArraySegment.cs
- SetterBaseCollection.cs
- InfocardExtendedInformationCollection.cs
- WebReference.cs
- HandleValueEditor.cs
- RequestCachingSection.cs
- ToolStripItemEventArgs.cs
- DependencyPropertyHelper.cs
- ImportContext.cs