diff options
Diffstat (limited to 'src/WixToolset.Core/ExtensibilityServices/ParseHelper.cs')
-rw-r--r-- | src/WixToolset.Core/ExtensibilityServices/ParseHelper.cs | 63 |
1 files changed, 49 insertions, 14 deletions
diff --git a/src/WixToolset.Core/ExtensibilityServices/ParseHelper.cs b/src/WixToolset.Core/ExtensibilityServices/ParseHelper.cs index 73a78a1f..8220ec25 100644 --- a/src/WixToolset.Core/ExtensibilityServices/ParseHelper.cs +++ b/src/WixToolset.Core/ExtensibilityServices/ParseHelper.cs | |||
@@ -53,19 +53,30 @@ namespace WixToolset.Core.ExtensibilityServices | |||
53 | 53 | ||
54 | public void CreateComplexReference(IntermediateSection section, SourceLineNumber sourceLineNumbers, ComplexReferenceParentType parentType, string parentId, string parentLanguage, ComplexReferenceChildType childType, string childId, bool isPrimary) | 54 | public void CreateComplexReference(IntermediateSection section, SourceLineNumber sourceLineNumbers, ComplexReferenceParentType parentType, string parentId, string parentLanguage, ComplexReferenceChildType childType, string childId, bool isPrimary) |
55 | { | 55 | { |
56 | var wixComplexReferenceRow = (WixComplexReferenceTuple)this.CreateRow(section, sourceLineNumbers, TupleDefinitionType.WixComplexReference); | ||
57 | wixComplexReferenceRow.Parent = parentId; | ||
58 | wixComplexReferenceRow.ParentType = parentType; | ||
59 | wixComplexReferenceRow.ParentLanguage = parentLanguage; | ||
60 | wixComplexReferenceRow.Child = childId; | ||
61 | wixComplexReferenceRow.ChildType = childType; | ||
62 | wixComplexReferenceRow.IsPrimary = isPrimary; | ||
63 | 56 | ||
64 | this.CreateWixGroupRow(section, sourceLineNumbers, parentType, parentId, childType, childId); | 57 | var tuple = new WixComplexReferenceTuple(sourceLineNumbers) |
58 | { | ||
59 | Parent = parentId, | ||
60 | ParentType = parentType, | ||
61 | ParentLanguage = parentLanguage, | ||
62 | Child = childId, | ||
63 | ChildType = childType, | ||
64 | IsPrimary = isPrimary | ||
65 | }; | ||
66 | |||
67 | section.Tuples.Add(tuple); | ||
68 | |||
69 | this.CreateWixGroupTuple(section, sourceLineNumbers, parentType, parentId, childType, childId); | ||
65 | } | 70 | } |
66 | 71 | ||
72 | [Obsolete] | ||
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) | 73 | 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) |
68 | { | 74 | { |
75 | return this.CreateDirectoryTuple(section, sourceLineNumbers, id, parentId, name, sectionInlinedDirectoryIds, shortName, sourceName, shortSourceName); | ||
76 | } | ||
77 | |||
78 | public Identifier CreateDirectoryTuple(IntermediateSection section, SourceLineNumber sourceLineNumbers, Identifier id, string parentId, string name, ISet<string> sectionInlinedDirectoryIds, string shortName = null, string sourceName = null, string shortSourceName = null) | ||
79 | { | ||
69 | string defaultDir; | 80 | string defaultDir; |
70 | 81 | ||
71 | if (name.Equals("SourceDir") || this.IsValidShortFilename(name, false)) | 82 | if (name.Equals("SourceDir") || this.IsValidShortFilename(name, false)) |
@@ -158,7 +169,7 @@ namespace WixToolset.Core.ExtensibilityServices | |||
158 | 169 | ||
159 | for (int i = pathStartsAt; i < inlineSyntax.Length; ++i) | 170 | for (int i = pathStartsAt; i < inlineSyntax.Length; ++i) |
160 | { | 171 | { |
161 | Identifier inlineId = this.CreateDirectoryRow(section, sourceLineNumbers, null, id, inlineSyntax[i], sectionInlinedDirectoryIds); | 172 | Identifier inlineId = this.CreateDirectoryTuple(section, sourceLineNumbers, null, id, inlineSyntax[i], sectionInlinedDirectoryIds); |
162 | id = inlineId.Id; | 173 | id = inlineId.Id; |
163 | } | 174 | } |
164 | } | 175 | } |
@@ -175,17 +186,23 @@ namespace WixToolset.Core.ExtensibilityServices | |||
175 | public Identifier CreateIdentifier(string prefix, params string[] args) | 186 | public Identifier CreateIdentifier(string prefix, params string[] args) |
176 | { | 187 | { |
177 | var id = Common.GenerateIdentifier(prefix, args); | 188 | var id = Common.GenerateIdentifier(prefix, args); |
178 | return new Identifier(id, AccessModifier.Private); | 189 | return new Identifier(AccessModifier.Private, id); |
179 | } | 190 | } |
180 | 191 | ||
181 | public Identifier CreateIdentifierFromFilename(string filename) | 192 | public Identifier CreateIdentifierFromFilename(string filename) |
182 | { | 193 | { |
183 | var id = Common.GetIdentifierFromName(filename); | 194 | var id = Common.GetIdentifierFromName(filename); |
184 | return new Identifier(id, AccessModifier.Private); | 195 | return new Identifier(AccessModifier.Private, id); |
185 | } | 196 | } |
186 | 197 | ||
198 | [Obsolete] | ||
187 | public Identifier CreateRegistryRow(IntermediateSection section, SourceLineNumber sourceLineNumbers, RegistryRootType root, string key, string name, string value, string componentId, bool escapeLeadingHash) | 199 | public Identifier CreateRegistryRow(IntermediateSection section, SourceLineNumber sourceLineNumbers, RegistryRootType root, string key, string name, string value, string componentId, bool escapeLeadingHash) |
188 | { | 200 | { |
201 | return this.CreateRegistryTuple(section, sourceLineNumbers, root, key, name, value, componentId, escapeLeadingHash); | ||
202 | } | ||
203 | |||
204 | public Identifier CreateRegistryTuple(IntermediateSection section, SourceLineNumber sourceLineNumbers, RegistryRootType root, string key, string name, string value, string componentId, bool escapeLeadingHash) | ||
205 | { | ||
189 | if (RegistryRootType.Unknown == root) | 206 | if (RegistryRootType.Unknown == root) |
190 | { | 207 | { |
191 | throw new ArgumentOutOfRangeException(nameof(root)); | 208 | throw new ArgumentOutOfRangeException(nameof(root)); |
@@ -234,8 +251,14 @@ namespace WixToolset.Core.ExtensibilityServices | |||
234 | section.Tuples.Add(tuple); | 251 | section.Tuples.Add(tuple); |
235 | } | 252 | } |
236 | 253 | ||
254 | [Obsolete] | ||
237 | public void CreateWixGroupRow(IntermediateSection section, SourceLineNumber sourceLineNumbers, ComplexReferenceParentType parentType, string parentId, ComplexReferenceChildType childType, string childId) | 255 | public void CreateWixGroupRow(IntermediateSection section, SourceLineNumber sourceLineNumbers, ComplexReferenceParentType parentType, string parentId, ComplexReferenceChildType childType, string childId) |
238 | { | 256 | { |
257 | this.CreateWixGroupTuple(section, sourceLineNumbers, parentType, parentId, childType, childId); | ||
258 | } | ||
259 | |||
260 | public void CreateWixGroupTuple(IntermediateSection section, SourceLineNumber sourceLineNumbers, ComplexReferenceParentType parentType, string parentId, ComplexReferenceChildType childType, string childId) | ||
261 | { | ||
239 | if (null == parentId || ComplexReferenceParentType.Unknown == parentType) | 262 | if (null == parentId || ComplexReferenceParentType.Unknown == parentType) |
240 | { | 263 | { |
241 | return; | 264 | return; |
@@ -257,8 +280,20 @@ namespace WixToolset.Core.ExtensibilityServices | |||
257 | section.Tuples.Add(tuple); | 280 | section.Tuples.Add(tuple); |
258 | } | 281 | } |
259 | 282 | ||
283 | [Obsolete] | ||
260 | public IntermediateTuple CreateRow(IntermediateSection section, SourceLineNumber sourceLineNumbers, string tableName, Identifier identifier = null) | 284 | public IntermediateTuple CreateRow(IntermediateSection section, SourceLineNumber sourceLineNumbers, string tableName, Identifier identifier = null) |
261 | { | 285 | { |
286 | return this.CreateTuple(section, sourceLineNumbers, tableName, identifier); | ||
287 | } | ||
288 | |||
289 | [Obsolete] | ||
290 | public IntermediateTuple CreateRow(IntermediateSection section, SourceLineNumber sourceLineNumbers, TupleDefinitionType tupleType, Identifier identifier = null) | ||
291 | { | ||
292 | return this.CreateTuple(section, sourceLineNumbers, tupleType, identifier); | ||
293 | } | ||
294 | |||
295 | public IntermediateTuple CreateTuple(IntermediateSection section, SourceLineNumber sourceLineNumbers, string tableName, Identifier identifier = null) | ||
296 | { | ||
262 | if (this.Creator == null) | 297 | if (this.Creator == null) |
263 | { | 298 | { |
264 | this.CreateTupleDefinitionCreator(); | 299 | this.CreateTupleDefinitionCreator(); |
@@ -272,7 +307,7 @@ namespace WixToolset.Core.ExtensibilityServices | |||
272 | return CreateRow(section, sourceLineNumbers, tupleDefinition, identifier); | 307 | return CreateRow(section, sourceLineNumbers, tupleDefinition, identifier); |
273 | } | 308 | } |
274 | 309 | ||
275 | public IntermediateTuple CreateRow(IntermediateSection section, SourceLineNumber sourceLineNumbers, TupleDefinitionType tupleType, Identifier identifier = null) | 310 | public IntermediateTuple CreateTuple(IntermediateSection section, SourceLineNumber sourceLineNumbers, TupleDefinitionType tupleType, Identifier identifier = null) |
276 | { | 311 | { |
277 | var tupleDefinition = TupleDefinitions.ByType(tupleType); | 312 | var tupleDefinition = TupleDefinitions.ByType(tupleType); |
278 | 313 | ||
@@ -331,7 +366,7 @@ namespace WixToolset.Core.ExtensibilityServices | |||
331 | 366 | ||
332 | public void EnsureTable(IntermediateSection section, SourceLineNumber sourceLineNumbers, string tableName) | 367 | public void EnsureTable(IntermediateSection section, SourceLineNumber sourceLineNumbers, string tableName) |
333 | { | 368 | { |
334 | var row = this.CreateRow(section, sourceLineNumbers, TupleDefinitionType.WixEnsureTable); | 369 | var row = this.CreateTuple(section, sourceLineNumbers, TupleDefinitionType.WixEnsureTable); |
335 | row.Set(0, tableName); | 370 | row.Set(0, tableName); |
336 | 371 | ||
337 | if (this.Creator == null) | 372 | if (this.Creator == null) |
@@ -428,7 +463,7 @@ namespace WixToolset.Core.ExtensibilityServices | |||
428 | this.Messaging.Write(WarningMessages.IdentifierTooLong(sourceLineNumbers, attribute.Parent.Name.LocalName, attribute.Name.LocalName, value)); | 463 | this.Messaging.Write(WarningMessages.IdentifierTooLong(sourceLineNumbers, attribute.Parent.Name.LocalName, attribute.Name.LocalName, value)); |
429 | } | 464 | } |
430 | 465 | ||
431 | return new Identifier(value, access); | 466 | return new Identifier(access, value); |
432 | } | 467 | } |
433 | 468 | ||
434 | public string GetAttributeIdentifierValue(SourceLineNumber sourceLineNumbers, XAttribute attribute) | 469 | public string GetAttributeIdentifierValue(SourceLineNumber sourceLineNumbers, XAttribute attribute) |