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
- DataPagerFieldCommandEventArgs.cs
- SerializationObjectManager.cs
- SessionChannels.cs
- QueuePathEditor.cs
- LogicalExpressionEditor.cs
- WebPartTransformerAttribute.cs
- ReturnEventArgs.cs
- RotateTransform3D.cs
- ColumnClickEvent.cs
- QualificationDataAttribute.cs
- DataGridCellEditEndingEventArgs.cs
- FreezableOperations.cs
- InterleavedZipPartStream.cs
- SslStream.cs
- IgnoreSectionHandler.cs
- OperationAbortedException.cs
- DescendentsWalkerBase.cs
- HttpResponseBase.cs
- Helpers.cs
- HostingPreferredMapPath.cs
- PropertyChangedEventArgs.cs
- future.cs
- TdsParserHelperClasses.cs
- _NetRes.cs
- ReachIDocumentPaginatorSerializer.cs
- UIAgentInitializationException.cs
- ThrowHelper.cs
- StringSorter.cs
- CultureInfo.cs
- OperationPerformanceCounters.cs
- KeyProperty.cs
- TrackingProfile.cs
- XmlAtomErrorReader.cs
- LocatorPartList.cs
- _FtpControlStream.cs
- WebPartRestoreVerb.cs
- WebPartVerbCollection.cs
- TextBlockAutomationPeer.cs
- TransformerInfoCollection.cs
- MethodRental.cs
- ClickablePoint.cs
- FixedSOMContainer.cs
- ScrollContentPresenter.cs
- PropertyValueUIItem.cs
- ServiceModelExtensionCollectionElement.cs
- HtmlFormParameterReader.cs
- Speller.cs
- ProxyWebPart.cs
- StoreItemCollection.Loader.cs
- ContractReference.cs
- AsyncStreamReader.cs
- SiteOfOriginContainer.cs
- SchemaMapping.cs
- DebugView.cs
- MissingMethodException.cs
- CacheDependency.cs
- ReflectionHelper.cs
- EditorPartChrome.cs
- ImageClickEventArgs.cs
- X509CertificateChain.cs
- AnonymousIdentificationSection.cs
- NativeMethods.cs
- IdentityReference.cs
- PreviewPageInfo.cs
- DataChangedEventManager.cs
- ParseHttpDate.cs
- Ops.cs
- WebBrowserProgressChangedEventHandler.cs
- ExpandableObjectConverter.cs
- PeerNameRecord.cs
- DataSourceSelectArguments.cs
- Serializer.cs
- SqlConnectionPoolProviderInfo.cs
- GlobalDataBindingHandler.cs
- Menu.cs
- PositiveTimeSpanValidator.cs
- Identifier.cs
- OdbcDataAdapter.cs
- GPPOINT.cs
- AppDomainShutdownMonitor.cs
- FactoryGenerator.cs
- UnsafeNativeMethods.cs
- SerialErrors.cs
- EncodingNLS.cs
- TcpAppDomainProtocolHandler.cs
- ChildrenQuery.cs
- UIPermission.cs
- SafeFileMapViewHandle.cs
- FixedSOMTextRun.cs
- ScriptBehaviorDescriptor.cs
- GlyphRun.cs
- SyndicationContent.cs
- EditCommandColumn.cs
- CodeArgumentReferenceExpression.cs
- DocumentCollection.cs
- AstTree.cs
- StringFormat.cs
- nulltextnavigator.cs
- BooleanProjectedSlot.cs
- ResourcesBuildProvider.cs