aboutsummaryrefslogtreecommitdiff
path: root/src/wixext
diff options
context:
space:
mode:
Diffstat (limited to 'src/wixext')
-rw-r--r--src/wixext/Symbols/WixRemoveFolderExSymbol.cs21
-rw-r--r--src/wixext/UtilCompiler.cs28
-rw-r--r--src/wixext/UtilTableDefinitions.cs1
3 files changed, 31 insertions, 19 deletions
diff --git a/src/wixext/Symbols/WixRemoveFolderExSymbol.cs b/src/wixext/Symbols/WixRemoveFolderExSymbol.cs
index 0c50ab8e..86352b6c 100644
--- a/src/wixext/Symbols/WixRemoveFolderExSymbol.cs
+++ b/src/wixext/Symbols/WixRemoveFolderExSymbol.cs
@@ -14,6 +14,7 @@ namespace WixToolset.Util
14 new IntermediateFieldDefinition(nameof(WixRemoveFolderExSymbolFields.ComponentRef), IntermediateFieldType.String), 14 new IntermediateFieldDefinition(nameof(WixRemoveFolderExSymbolFields.ComponentRef), IntermediateFieldType.String),
15 new IntermediateFieldDefinition(nameof(WixRemoveFolderExSymbolFields.Property), IntermediateFieldType.String), 15 new IntermediateFieldDefinition(nameof(WixRemoveFolderExSymbolFields.Property), IntermediateFieldType.String),
16 new IntermediateFieldDefinition(nameof(WixRemoveFolderExSymbolFields.InstallMode), IntermediateFieldType.Number), 16 new IntermediateFieldDefinition(nameof(WixRemoveFolderExSymbolFields.InstallMode), IntermediateFieldType.Number),
17 new IntermediateFieldDefinition(nameof(WixRemoveFolderExSymbolFields.Condition), IntermediateFieldType.String),
17 }, 18 },
18 typeof(WixRemoveFolderExSymbol)); 19 typeof(WixRemoveFolderExSymbol));
19 } 20 }
@@ -28,6 +29,14 @@ namespace WixToolset.Util.Symbols
28 ComponentRef, 29 ComponentRef,
29 Property, 30 Property,
30 InstallMode, 31 InstallMode,
32 Condition,
33 }
34
35 public enum WixRemoveFolderExInstallMode
36 {
37 Install = 1,
38 Uninstall = 2,
39 Both = 3,
31 } 40 }
32 41
33 public class WixRemoveFolderExSymbol : IntermediateSymbol 42 public class WixRemoveFolderExSymbol : IntermediateSymbol
@@ -54,10 +63,16 @@ namespace WixToolset.Util.Symbols
54 set => this.Set((int)WixRemoveFolderExSymbolFields.Property, value); 63 set => this.Set((int)WixRemoveFolderExSymbolFields.Property, value);
55 } 64 }
56 65
57 public int InstallMode 66 public WixRemoveFolderExInstallMode InstallMode
67 {
68 get => (WixRemoveFolderExInstallMode)this.Fields[(int)WixRemoveFolderExSymbolFields.InstallMode].AsNumber();
69 set => this.Set((int)WixRemoveFolderExSymbolFields.InstallMode, (int)value);
70 }
71
72 public string Condition
58 { 73 {
59 get => this.Fields[(int)WixRemoveFolderExSymbolFields.InstallMode].AsNumber(); 74 get => this.Fields[(int)WixRemoveFolderExSymbolFields.Condition].AsString();
60 set => this.Set((int)WixRemoveFolderExSymbolFields.InstallMode, value); 75 set => this.Set((int)WixRemoveFolderExSymbolFields.Condition, value);
61 } 76 }
62 } 77 }
63} \ No newline at end of file 78} \ No newline at end of file
diff --git a/src/wixext/UtilCompiler.cs b/src/wixext/UtilCompiler.cs
index 12213e63..63f2b469 100644
--- a/src/wixext/UtilCompiler.cs
+++ b/src/wixext/UtilCompiler.cs
@@ -41,13 +41,6 @@ namespace WixToolset.Util
41 Compatible, 41 Compatible,
42 } 42 }
43 43
44 internal enum WixRemoveFolderExOn
45 {
46 Install = 1,
47 Uninstall = 2,
48 Both = 3,
49 }
50
51 private static readonly Regex FindPropertyBrackets = new Regex(@"\[(?!\\|\])|(?<!\[\\\]|\[\\|\\\[)\]", RegexOptions.ExplicitCapture | RegexOptions.Compiled); 44 private static readonly Regex FindPropertyBrackets = new Regex(@"\[(?!\\|\])|(?<!\[\\\]|\[\\|\\\[)\]", RegexOptions.ExplicitCapture | RegexOptions.Compiled);
52 45
53 public override XNamespace Namespace => "http://wixtoolset.org/schemas/v4/wxs/util"; 46 public override XNamespace Namespace => "http://wixtoolset.org/schemas/v4/wxs/util";
@@ -2812,8 +2805,9 @@ namespace WixToolset.Util
2812 { 2805 {
2813 var sourceLineNumbers = this.ParseHelper.GetSourceLineNumbers(element); 2806 var sourceLineNumbers = this.ParseHelper.GetSourceLineNumbers(element);
2814 Identifier id = null; 2807 Identifier id = null;
2815 var on = (int)WixRemoveFolderExOn.Uninstall; 2808 var mode = WixRemoveFolderExInstallMode.Uninstall;
2816 string property = null; 2809 string property = null;
2810 string condition = null;
2817 2811
2818 foreach (var attrib in element.Attributes()) 2812 foreach (var attrib in element.Attributes())
2819 { 2813 {
@@ -2821,6 +2815,9 @@ namespace WixToolset.Util
2821 { 2815 {
2822 switch (attrib.Name.LocalName) 2816 switch (attrib.Name.LocalName)
2823 { 2817 {
2818 case "Condition":
2819 condition = this.ParseHelper.GetAttributeValue(sourceLineNumbers, attrib);
2820 break;
2824 case "Id": 2821 case "Id":
2825 id = this.ParseHelper.GetAttributeIdentifier(sourceLineNumbers, attrib); 2822 id = this.ParseHelper.GetAttributeIdentifier(sourceLineNumbers, attrib);
2826 break; 2823 break;
@@ -2828,24 +2825,22 @@ namespace WixToolset.Util
2828 var onValue = this.ParseHelper.GetAttributeValue(sourceLineNumbers, attrib); 2825 var onValue = this.ParseHelper.GetAttributeValue(sourceLineNumbers, attrib);
2829 if (onValue.Length == 0) 2826 if (onValue.Length == 0)
2830 { 2827 {
2831 on = CompilerConstants.IllegalInteger;
2832 } 2828 }
2833 else 2829 else
2834 { 2830 {
2835 switch (onValue) 2831 switch (onValue)
2836 { 2832 {
2837 case "install": 2833 case "install":
2838 on = (int)WixRemoveFolderExOn.Install; 2834 mode = WixRemoveFolderExInstallMode.Install;
2839 break; 2835 break;
2840 case "uninstall": 2836 case "uninstall":
2841 on = (int)WixRemoveFolderExOn.Uninstall; 2837 mode = WixRemoveFolderExInstallMode.Uninstall;
2842 break; 2838 break;
2843 case "both": 2839 case "both":
2844 on = (int)WixRemoveFolderExOn.Both; 2840 mode = WixRemoveFolderExInstallMode.Both;
2845 break; 2841 break;
2846 default: 2842 default:
2847 this.Messaging.Write(ErrorMessages.IllegalAttributeValue(sourceLineNumbers, element.Name.LocalName, "On", onValue, "install", "uninstall", "both")); 2843 this.Messaging.Write(ErrorMessages.IllegalAttributeValue(sourceLineNumbers, element.Name.LocalName, "On", onValue, "install", "uninstall", "both"));
2848 on = CompilerConstants.IllegalInteger;
2849 break; 2844 break;
2850 } 2845 }
2851 } 2846 }
@@ -2869,9 +2864,9 @@ namespace WixToolset.Util
2869 this.Messaging.Write(ErrorMessages.ExpectedAttribute(sourceLineNumbers, element.Name.LocalName, "Property")); 2864 this.Messaging.Write(ErrorMessages.ExpectedAttribute(sourceLineNumbers, element.Name.LocalName, "Property"));
2870 } 2865 }
2871 2866
2872 if (null == id) 2867 if (id == null)
2873 { 2868 {
2874 id = this.ParseHelper.CreateIdentifier("wrf", componentId, property, on.ToString(CultureInfo.InvariantCulture.NumberFormat)); 2869 id = this.ParseHelper.CreateIdentifier("wrf", componentId, property, mode.ToString());
2875 } 2870 }
2876 2871
2877 this.ParseHelper.ParseForExtensionElements(this.Context.Extensions, intermediate, section, element); 2872 this.ParseHelper.ParseForExtensionElements(this.Context.Extensions, intermediate, section, element);
@@ -2884,7 +2879,8 @@ namespace WixToolset.Util
2884 { 2879 {
2885 ComponentRef = componentId, 2880 ComponentRef = componentId,
2886 Property = property, 2881 Property = property,
2887 InstallMode = on, 2882 InstallMode = mode,
2883 Condition = condition
2888 }); 2884 });
2889 2885
2890 this.ParseHelper.EnsureTable(section, sourceLineNumbers, "RemoveFile"); 2886 this.ParseHelper.EnsureTable(section, sourceLineNumbers, "RemoveFile");
diff --git a/src/wixext/UtilTableDefinitions.cs b/src/wixext/UtilTableDefinitions.cs
index eff5aaf6..fd09367a 100644
--- a/src/wixext/UtilTableDefinitions.cs
+++ b/src/wixext/UtilTableDefinitions.cs
@@ -33,6 +33,7 @@ namespace WixToolset.Util
33 new ColumnDefinition("Component_", ColumnType.String, 72, primaryKey: false, nullable: false, ColumnCategory.Identifier, keyTable: "Component", keyColumn: 1, description: "Foreign key into the Component table used to determine install state", modularizeType: ColumnModularizeType.Column), 33 new ColumnDefinition("Component_", ColumnType.String, 72, primaryKey: false, nullable: false, ColumnCategory.Identifier, keyTable: "Component", keyColumn: 1, description: "Foreign key into the Component table used to determine install state", modularizeType: ColumnModularizeType.Column),
34 new ColumnDefinition("Property", ColumnType.String, 72, primaryKey: false, nullable: false, ColumnCategory.Identifier, description: "Name of Property that contains the root of the directory tree to remove.", modularizeType: ColumnModularizeType.Column), 34 new ColumnDefinition("Property", ColumnType.String, 72, primaryKey: false, nullable: false, ColumnCategory.Identifier, description: "Name of Property that contains the root of the directory tree to remove.", modularizeType: ColumnModularizeType.Column),
35 new ColumnDefinition("InstallMode", ColumnType.Number, 2, primaryKey: false, nullable: false, ColumnCategory.Unknown, minValue: 1, maxValue: 3, description: "1 == Remove only when the associated component is being installed (msiInstallStateLocal or msiInstallStateSource), 2 == Remove only when the associated component is being removed (msiInstallStateAbsent), 3 = Remove in either of the above cases."), 35 new ColumnDefinition("InstallMode", ColumnType.Number, 2, primaryKey: false, nullable: false, ColumnCategory.Unknown, minValue: 1, maxValue: 3, description: "1 == Remove only when the associated component is being installed (msiInstallStateLocal or msiInstallStateSource), 2 == Remove only when the associated component is being removed (msiInstallStateAbsent), 3 = Remove in either of the above cases."),
36 new ColumnDefinition("Condition", ColumnType.String, 0, primaryKey: false, nullable: true, ColumnCategory.Condition, description: "Optional expression which skips the removing of folders.", modularizeType: ColumnModularizeType.Condition, forceLocalizable: true),
36 }, 37 },
37 symbolIdIsPrimaryKey: true 38 symbolIdIsPrimaryKey: true
38 ); 39 );