diff options
| author | Rob Mensching <rob@firegiant.com> | 2019-05-08 23:57:15 -0700 |
|---|---|---|
| committer | Rob Mensching <rob@firegiant.com> | 2019-05-09 00:04:17 -0700 |
| commit | 32b691d23c76fbe12790808d65b0b615640ebebe (patch) | |
| tree | 2f62c185af5dc02355459d5f4719aa0bbf7b0f20 /src/WixToolset.Core/ExtensibilityServices | |
| parent | 75fd55d5a71c492c6ea904768858c51aa97da29f (diff) | |
| download | wix-32b691d23c76fbe12790808d65b0b615640ebebe.tar.gz wix-32b691d23c76fbe12790808d65b0b615640ebebe.tar.bz2 wix-32b691d23c76fbe12790808d65b0b615640ebebe.zip | |
Implement and use IParseHelper.ScheduleActionTuple
Diffstat (limited to 'src/WixToolset.Core/ExtensibilityServices')
| -rw-r--r-- | src/WixToolset.Core/ExtensibilityServices/ParseHelper.cs | 63 |
1 files changed, 56 insertions, 7 deletions
diff --git a/src/WixToolset.Core/ExtensibilityServices/ParseHelper.cs b/src/WixToolset.Core/ExtensibilityServices/ParseHelper.cs index 9d4a7cbd..73a78a1f 100644 --- a/src/WixToolset.Core/ExtensibilityServices/ParseHelper.cs +++ b/src/WixToolset.Core/ExtensibilityServices/ParseHelper.cs | |||
| @@ -13,6 +13,7 @@ namespace WixToolset.Core.ExtensibilityServices | |||
| 13 | using System.Xml.Linq; | 13 | using System.Xml.Linq; |
| 14 | using WixToolset.Data; | 14 | using WixToolset.Data; |
| 15 | using WixToolset.Data.Tuples; | 15 | using WixToolset.Data.Tuples; |
| 16 | using WixToolset.Data.WindowsInstaller; | ||
| 16 | using WixToolset.Extensibility; | 17 | using WixToolset.Extensibility; |
| 17 | using WixToolset.Extensibility.Data; | 18 | using WixToolset.Extensibility.Data; |
| 18 | using WixToolset.Extensibility.Services; | 19 | using WixToolset.Extensibility.Services; |
| @@ -63,9 +64,9 @@ namespace WixToolset.Core.ExtensibilityServices | |||
| 63 | this.CreateWixGroupRow(section, sourceLineNumbers, parentType, parentId, childType, childId); | 64 | this.CreateWixGroupRow(section, sourceLineNumbers, parentType, parentId, childType, childId); |
| 64 | } | 65 | } |
| 65 | 66 | ||
| 66 | public Identifier CreateDirectoryRow(IntermediateSection section, SourceLineNumber sourceLineNumbers, Identifier id, string parentId, string name, string shortName = null, string sourceName = null, string shortSourceName = null, ISet<string> sectionInlinedDirectoryIds = null) | 67 | public Identifier CreateDirectoryRow(IntermediateSection section, SourceLineNumber sourceLineNumbers, Identifier id, string parentId, string name, ISet<string> sectionInlinedDirectoryIds, string shortName = null, string sourceName = null, string shortSourceName = null) |
| 67 | { | 68 | { |
| 68 | string defaultDir = null; | 69 | string defaultDir; |
| 69 | 70 | ||
| 70 | if (name.Equals("SourceDir") || this.IsValidShortFilename(name, false)) | 71 | if (name.Equals("SourceDir") || this.IsValidShortFilename(name, false)) |
| 71 | { | 72 | { |
| @@ -111,13 +112,18 @@ namespace WixToolset.Core.ExtensibilityServices | |||
| 111 | } | 112 | } |
| 112 | } | 113 | } |
| 113 | 114 | ||
| 114 | var row = this.CreateRow(section, sourceLineNumbers, TupleDefinitionType.Directory, id); | 115 | var tuple = new DirectoryTuple(sourceLineNumbers, id) |
| 115 | row.Set(1, parentId); | 116 | { |
| 116 | row.Set(2, defaultDir); | 117 | Directory_Parent = parentId, |
| 118 | DefaultDir = defaultDir, | ||
| 119 | }; | ||
| 120 | |||
| 121 | section.Tuples.Add(tuple); | ||
| 122 | |||
| 117 | return id; | 123 | return id; |
| 118 | } | 124 | } |
| 119 | 125 | ||
| 120 | public string CreateDirectoryReferenceFromInlineSyntax(IntermediateSection section, SourceLineNumber sourceLineNumbers, XAttribute attribute, string parentId) | 126 | public string CreateDirectoryReferenceFromInlineSyntax(IntermediateSection section, SourceLineNumber sourceLineNumbers, string parentId, XAttribute attribute, ISet<string> sectionInlinedDirectoryIds) |
| 121 | { | 127 | { |
| 122 | string id = null; | 128 | string id = null; |
| 123 | string[] inlineSyntax = this.GetAttributeInlineDirectorySyntax(sourceLineNumbers, attribute, true); | 129 | string[] inlineSyntax = this.GetAttributeInlineDirectorySyntax(sourceLineNumbers, attribute, true); |
| @@ -152,7 +158,7 @@ namespace WixToolset.Core.ExtensibilityServices | |||
| 152 | 158 | ||
| 153 | for (int i = pathStartsAt; i < inlineSyntax.Length; ++i) | 159 | for (int i = pathStartsAt; i < inlineSyntax.Length; ++i) |
| 154 | { | 160 | { |
| 155 | Identifier inlineId = this.CreateDirectoryRow(section, sourceLineNumbers, null, id, inlineSyntax[i]); | 161 | Identifier inlineId = this.CreateDirectoryRow(section, sourceLineNumbers, null, id, inlineSyntax[i], sectionInlinedDirectoryIds); |
| 156 | id = inlineId.Id; | 162 | id = inlineId.Id; |
| 157 | } | 163 | } |
| 158 | } | 164 | } |
| @@ -826,6 +832,49 @@ namespace WixToolset.Core.ExtensibilityServices | |||
| 826 | } | 832 | } |
| 827 | } | 833 | } |
| 828 | 834 | ||
| 835 | public WixActionTuple ScheduleActionTuple(IntermediateSection section, SourceLineNumber sourceLineNumbers, AccessModifier access, SequenceTable sequence, string actionName, string condition, string beforeAction, string afterAction, bool overridable = false) | ||
| 836 | { | ||
| 837 | var actionId = new Identifier(access, sequence, actionName); | ||
| 838 | |||
| 839 | var actionTuple = new WixActionTuple(sourceLineNumbers, actionId) | ||
| 840 | { | ||
| 841 | SequenceTable = sequence, | ||
| 842 | Action = actionName, | ||
| 843 | Condition = condition, | ||
| 844 | Before = beforeAction, | ||
| 845 | After = afterAction, | ||
| 846 | Overridable = overridable, | ||
| 847 | }; | ||
| 848 | |||
| 849 | section.Tuples.Add(actionTuple); | ||
| 850 | |||
| 851 | if (null != beforeAction) | ||
| 852 | { | ||
| 853 | if (WindowsInstallerStandard.IsStandardAction(beforeAction)) | ||
| 854 | { | ||
| 855 | this.CreateSimpleReference(section, sourceLineNumbers, "WixAction", sequence.ToString(), beforeAction); | ||
| 856 | } | ||
| 857 | else | ||
| 858 | { | ||
| 859 | this.CreateSimpleReference(section, sourceLineNumbers, "CustomAction", beforeAction); | ||
| 860 | } | ||
| 861 | } | ||
| 862 | |||
| 863 | if (null != afterAction) | ||
| 864 | { | ||
| 865 | if (WindowsInstallerStandard.IsStandardAction(afterAction)) | ||
| 866 | { | ||
| 867 | this.CreateSimpleReference(section, sourceLineNumbers, "WixAction", sequence.ToString(), afterAction); | ||
| 868 | } | ||
| 869 | else | ||
| 870 | { | ||
| 871 | this.CreateSimpleReference(section, sourceLineNumbers, "CustomAction", afterAction); | ||
| 872 | } | ||
| 873 | } | ||
| 874 | |||
| 875 | return actionTuple; | ||
| 876 | } | ||
| 877 | |||
| 829 | public void UnexpectedAttribute(XElement element, XAttribute attribute) | 878 | public void UnexpectedAttribute(XElement element, XAttribute attribute) |
| 830 | { | 879 | { |
| 831 | var sourceLineNumbers = Preprocessor.GetSourceLineNumbers(element); | 880 | var sourceLineNumbers = Preprocessor.GetSourceLineNumbers(element); |
