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
- DataGridAutomationPeer.cs
- DbDataReader.cs
- ExtensibleClassFactory.cs
- DigestComparer.cs
- WindowAutomationPeer.cs
- Animatable.cs
- MemberInitExpression.cs
- ToolStripPanelSelectionGlyph.cs
- ParagraphVisual.cs
- ReplacementText.cs
- ExtensionCollection.cs
- PriorityQueue.cs
- ThreadStateException.cs
- InstanceDataCollectionCollection.cs
- SchemaType.cs
- RawAppCommandInputReport.cs
- SyndicationItem.cs
- CheckBox.cs
- XAMLParseException.cs
- StatusStrip.cs
- StylusPointPropertyInfoDefaults.cs
- GridViewColumnCollectionChangedEventArgs.cs
- EnumValAlphaComparer.cs
- ping.cs
- DbConnectionFactory.cs
- UidManager.cs
- PropertiesTab.cs
- DispatcherExceptionEventArgs.cs
- PeerCollaboration.cs
- TextServicesHost.cs
- ColorTransformHelper.cs
- RawKeyboardInputReport.cs
- PolyQuadraticBezierSegment.cs
- WindowAutomationPeer.cs
- ServerProtocol.cs
- ToolStripHighContrastRenderer.cs
- EventBuilder.cs
- Resources.Designer.cs
- CaretElement.cs
- printdlgexmarshaler.cs
- XmlSchemaGroup.cs
- LocalizabilityAttribute.cs
- EventLogPermissionEntry.cs
- MatrixTransform.cs
- RootBrowserWindowProxy.cs
- SynchronizationContext.cs
- XPathAxisIterator.cs
- webproxy.cs
- BookmarkOptionsHelper.cs
- WinCategoryAttribute.cs
- AutomationProperties.cs
- HtmlInputReset.cs
- QilValidationVisitor.cs
- SelectedGridItemChangedEvent.cs
- DataContractSerializerSection.cs
- AppearanceEditorPart.cs
- SplitterPanel.cs
- TreeViewEvent.cs
- StorageAssociationSetMapping.cs
- AutomationAttributeInfo.cs
- MenuAdapter.cs
- SystemKeyConverter.cs
- AnnotationHelper.cs
- EntitySetBaseCollection.cs
- MULTI_QI.cs
- StyleSelector.cs
- SystemIcmpV4Statistics.cs
- ExtensionCollection.cs
- ProgressPage.cs
- BrowsableAttribute.cs
- EastAsianLunisolarCalendar.cs
- SubMenuStyleCollectionEditor.cs
- ReadOnlyHierarchicalDataSourceView.cs
- NotificationContext.cs
- HtmlLabelAdapter.cs
- EncodingInfo.cs
- SurrogateSelector.cs
- RegisteredHiddenField.cs
- DeploymentExceptionMapper.cs
- ArraySortHelper.cs
- UserNamePasswordClientCredential.cs
- HttpCookiesSection.cs
- QilXmlReader.cs
- BuilderPropertyEntry.cs
- latinshape.cs
- ReadOnlyDictionary.cs
- StrictAndMessageFilter.cs
- HijriCalendar.cs
- CharacterBufferReference.cs
- TransactionManager.cs
- WebPartsSection.cs
- httpapplicationstate.cs
- COM2ComponentEditor.cs
- HtmlLink.cs
- XmlSchemaCompilationSettings.cs
- DataServiceQueryException.cs
- TextServicesCompartment.cs
- ZipIOExtraFieldPaddingElement.cs
- SimpleMailWebEventProvider.cs
- SerializationSectionGroup.cs