Fix custom table & custom action decompilation.
Bob Arnson committed
Aug 25, 2020 at 14:58 UTC
c2d23a0d9c4d7b7205a288b1aa912b7f8d68702d
3 files changed
+22
-11
src/WixToolset.Converters/WixConverter.cs
+6
-3
@@ -47,6 +47,7 @@ namespace WixToolset.Converters
47
private static readonly XName ConditionElementName = WixNamespace + "Condition";
48
private static readonly XName CreateFolderElementName = WixNamespace + "CreateFolder";
49
private static readonly XName CustomTableElementName = WixNamespace + "CustomTable";
50
+ private static readonly XName DataElementName = WixNamespace + "Data";
51
private static readonly XName DirectoryElementName = WixNamespace + "Directory";
52
private static readonly XName ErrorElementName = WixNamespace + "Error";
53
private static readonly XName FeatureElementName = WixNamespace + "Feature";
@@ -137,6 +138,7 @@ namespace WixToolset.Converters
138
{ WixConverter.CustomTableElementName, this.ConvertCustomTableElement },
139
{ WixConverter.ControlElementName, this.ConvertControlElement },
140
{ WixConverter.ComponentElementName, this.ConvertComponentElement },
141
+ { WixConverter.DataElementName, this.ConvertDataElement },
142
{ WixConverter.DirectoryElementName, this.ConvertDirectoryElement },
143
{ WixConverter.FeatureElementName, this.ConvertFeatureElement },
144
{ WixConverter.FileElementName, this.ConvertFileElement },
@@ -155,7 +157,6 @@ namespace WixToolset.Converters
157
{ WixConverter.PublishElementName, this.ConvertPublishElement },
158
{ WixConverter.MultiStringValueElementName, this.ConvertMultiStringValueElement },
159
{ WixConverter.RequiredPrivilegeElementName, this.ConvertRequiredPrivilegeElement },
158
- { WixConverter.RowElementName, this.ConvertRowElement },
160
{ WixConverter.CustomActionElementName, this.ConvertCustomActionElement },
161
{ WixConverter.ServiceArgumentElementName, this.ConvertServiceArgumentElement },
162
{ WixConverter.SetDirectoryElementName, this.ConvertSetDirectoryElement },
@@ -719,6 +720,8 @@ namespace WixToolset.Converters
720
721
private void ConvertRowElement(XElement element) => this.ConvertInnerTextToAttribute(element, "Value");
722
723
+ private void ConvertDataElement(XElement element) => this.ConvertInnerTextToAttribute(element, "Value");
724
+
725
private void ConvertSequenceElement(XElement element)
726
{
727
foreach (var child in element.Elements())
@@ -801,7 +804,7 @@ namespace WixToolset.Converters
804
805
if (xScript != null && TryGetInnerText(xCustomAction, out var scriptText))
806
{
804
- if (this.OnError(ConverterTestType.InnerTextDeprecated, xCustomAction, "Using {0} element text is deprecated. Extract the text to a file and use the 'ScriptFile' attribute to reference it.", xCustomAction.Name.LocalName))
807
+ if (this.OnError(ConverterTestType.InnerTextDeprecated, xCustomAction, "Using {0} element text is deprecated. Extract the text to a file and use the 'ScriptSourceFile' attribute to reference it.", xCustomAction.Name.LocalName))
808
{
809
var scriptFolder = Path.GetDirectoryName(this.SourceFile) ?? String.Empty;
810
var id = xCustomAction.Attribute("Id")?.Value ?? Guid.NewGuid().ToString("N");
@@ -811,7 +814,7 @@ namespace WixToolset.Converters
814
File.WriteAllText(scriptFile, scriptText);
815
816
RemoveChildren(xCustomAction);
814
- xCustomAction.Add(new XAttribute("ScriptFile", scriptFile));
817
+ xCustomAction.Add(new XAttribute("ScriptSourceFile", scriptFile));
818
}
819
}
820
}
src/test/WixToolsetTest.Converters/CustomActionFixture.cs
+1
-1
@@ -60,7 +60,7 @@ namespace WixToolsetTest.Converters
60
61
var expected = String.Join(Environment.NewLine,
62
"<Wix xmlns=\"http://wixtoolset.org/schemas/v4/wxs\">",
63
- " <CustomAction Id=\"Foo\" Script=\"jscript\" ScriptFile=\"Foo.js\" />",
63
+ " <CustomAction Id=\"Foo\" Script=\"jscript\" ScriptSourceFile=\"Foo.js\" />",
64
"</Wix>");
65
66
var expectedScript = String.Join("\n",
src/test/WixToolsetTest.Converters/CustomTableFixture.cs
+15
-7
@@ -54,8 +54,10 @@ namespace WixToolsetTest.Converters
54
"<Wix xmlns='http://schemas.microsoft.com/wix/2006/wi'>",
55
" <Fragment>",
56
" <CustomTable Id='Custom1'>",
57
- " <Row Id='Column1'>",
57
+ " <Row>",
58
+ " <Data Id='Column1'>",
59
" Some value",
60
+ " </Data>",
61
" </Row>",
62
" </CustomTable>",
63
" </Fragment>",
@@ -66,7 +68,9 @@ namespace WixToolsetTest.Converters
68
"<Wix xmlns=\"http://wixtoolset.org/schemas/v4/wxs\">",
69
" <Fragment>",
70
" <CustomTable Id=\"Custom1\">",
69
- " <Row Id=\"Column1\" Value=\"Some value\" />",
71
+ " <Row>",
72
+ " <Data Id=\"Column1\" Value=\"Some value\" />",
73
+ " </Row>",
74
" </CustomTable>",
75
" </Fragment>",
76
"</Wix>"
@@ -91,10 +95,12 @@ namespace WixToolsetTest.Converters
95
"<Wix xmlns='http://schemas.microsoft.com/wix/2006/wi'>",
96
" <Fragment>",
97
" <CustomTable Id='Custom1'>",
94
- " <Row Id='Column1'>",
95
- " <![CDATA[",
96
- " Some value",
97
- " ]]>",
98
+ " <Row>",
99
+ " <Data Id='Column1'>",
100
+ " <![CDATA[",
101
+ " Some value",
102
+ " ]]>",
103
+ " </Data>",
104
" </Row>",
105
" </CustomTable>",
106
" </Fragment>",
@@ -105,7 +111,9 @@ namespace WixToolsetTest.Converters
111
"<Wix xmlns=\"http://wixtoolset.org/schemas/v4/wxs\">",
112
" <Fragment>",
113
" <CustomTable Id=\"Custom1\">",
108
- " <Row Id=\"Column1\" Value=\"Some value\" />",
114
+ " <Row>",
115
+ " <Data Id=\"Column1\" Value=\"Some value\" />",
116
+ " </Row>",
117
" </CustomTable>",
118
" </Fragment>",
119
"</Wix>"