| 1 | // Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information. |
| 2 | |
| 3 | namespace WixToolset.Core.Burn |
| 4 | { |
| 5 | using System.Xml; |
| 6 | using WixToolset.Data.Symbols; |
| 7 | |
| 8 | internal class SetVariableSearchFacade : BaseSearchFacade |
| 9 | { |
| 10 | public SetVariableSearchFacade(WixSearchSymbol searchSymbol, WixSetVariableSymbol setVariableSymbol) |
| 11 | { |
| 12 | this.SearchSymbol = searchSymbol; |
| 13 | this.SetVariableSymbol = setVariableSymbol; |
| 14 | } |
| 15 | |
| 16 | private WixSetVariableSymbol SetVariableSymbol { get; } |
| 17 | |
| 18 | public override void WriteXml(XmlTextWriter writer) |
| 19 | { |
| 20 | writer.WriteStartElement("SetVariable"); |
| 21 | |
| 22 | base.WriteXml(writer); |
| 23 | |
| 24 | if (this.SetVariableSymbol.Type != WixBundleVariableType.Unknown) |
| 25 | { |
| 26 | writer.WriteAttributeString("Value", this.SetVariableSymbol.Value); |
| 27 | |
| 28 | switch (this.SetVariableSymbol.Type) |
| 29 | { |
| 30 | case WixBundleVariableType.Formatted: |
| 31 | writer.WriteAttributeString("Type", "formatted"); |
| 32 | break; |
| 33 | case WixBundleVariableType.Numeric: |
| 34 | writer.WriteAttributeString("Type", "numeric"); |
| 35 | break; |
| 36 | case WixBundleVariableType.String: |
| 37 | writer.WriteAttributeString("Type", "string"); |
| 38 | break; |
| 39 | case WixBundleVariableType.Version: |
| 40 | writer.WriteAttributeString("Type", "version"); |
| 41 | break; |
| 42 | } |
| 43 | } |
| 44 | |
| 45 | writer.WriteEndElement(); |
| 46 | } |
| 47 | } |
| 48 | } |