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
- OracleColumn.cs
- DataGridHelper.cs
- EllipticalNodeOperations.cs
- ExceptionCollection.cs
- ImpersonateTokenRef.cs
- IPipelineRuntime.cs
- SizeConverter.cs
- Evaluator.cs
- DataControlImageButton.cs
- DataGrid.cs
- Unit.cs
- WebPartDescription.cs
- IntSecurity.cs
- HtmlTable.cs
- validation.cs
- WebControlsSection.cs
- XPathParser.cs
- PersonalizationStateInfo.cs
- ExecutionEngineException.cs
- SqlDataRecord.cs
- ComplexObject.cs
- GenericTextProperties.cs
- AppDomainFactory.cs
- SupportsPreviewControlAttribute.cs
- GeneralTransform3D.cs
- RoutingConfiguration.cs
- EncodingInfo.cs
- UnmanagedMarshal.cs
- ScriptReferenceBase.cs
- TreeView.cs
- RangeValidator.cs
- CollectionAdapters.cs
- DynamicResourceExtensionConverter.cs
- IdleTimeoutMonitor.cs
- SingleAnimation.cs
- CancellationHandlerDesigner.cs
- MarginCollapsingState.cs
- MatrixTransform3D.cs
- ReadOnlyDataSource.cs
- OverrideMode.cs
- UncommonField.cs
- Switch.cs
- WebPartUserCapability.cs
- IgnoreSectionHandler.cs
- AttachedPropertyBrowsableForChildrenAttribute.cs
- InputReferenceExpression.cs
- ImportOptions.cs
- ObjectConverter.cs
- FrameworkReadOnlyPropertyMetadata.cs
- QualificationDataAttribute.cs
- XmlSchemaSimpleTypeUnion.cs
- PhysicalOps.cs
- ProcessHostMapPath.cs
- HebrewCalendar.cs
- SqlClientMetaDataCollectionNames.cs
- COAUTHINFO.cs
- DynamicActivityTypeDescriptor.cs
- TypeDelegator.cs
- Peer.cs
- ZipIOExtraFieldElement.cs
- DecimalStorage.cs
- BitmapEffect.cs
- DurableTimerExtension.cs
- SMSvcHost.cs
- ValidationErrorEventArgs.cs
- SafeNativeMethodsOther.cs
- XPathSingletonIterator.cs
- InstanceDescriptor.cs
- ColorPalette.cs
- DebugViewWriter.cs
- PersonalizationState.cs
- XMLSyntaxException.cs
- srgsitem.cs
- DesignerListAdapter.cs
- BuildManagerHost.cs
- ValuePattern.cs
- TransformFinalBlockRequest.cs
- LogEntrySerializationException.cs
- DataControlFieldsEditor.cs
- ArglessEventHandlerProxy.cs
- VisualBasicSettings.cs
- SrgsText.cs
- OracleNumber.cs
- TreeNodeStyle.cs
- HighContrastHelper.cs
- Compiler.cs
- RuntimeConfigLKG.cs
- ErrorEventArgs.cs
- validation.cs
- ConsoleKeyInfo.cs
- PerCallInstanceContextProvider.cs
- XmlLanguageConverter.cs
- AspNetSynchronizationContext.cs
- Stroke2.cs
- HostUtils.cs
- SessionStateContainer.cs
- SessionStateItemCollection.cs
- TableLayoutColumnStyleCollection.cs
- SystemGatewayIPAddressInformation.cs
- XmlWhitespace.cs