aboutsummaryrefslogtreecommitdiff
path: root/src/WixToolset.Core/Bind/ResolveFieldsCommand.cs
diff options
context:
space:
mode:
Diffstat (limited to 'src/WixToolset.Core/Bind/ResolveFieldsCommand.cs')
-rw-r--r--src/WixToolset.Core/Bind/ResolveFieldsCommand.cs38
1 files changed, 19 insertions, 19 deletions
diff --git a/src/WixToolset.Core/Bind/ResolveFieldsCommand.cs b/src/WixToolset.Core/Bind/ResolveFieldsCommand.cs
index af7e262a..629e5f28 100644
--- a/src/WixToolset.Core/Bind/ResolveFieldsCommand.cs
+++ b/src/WixToolset.Core/Bind/ResolveFieldsCommand.cs
@@ -6,7 +6,7 @@ namespace WixToolset.Core.Bind
6 using System.Collections.Generic; 6 using System.Collections.Generic;
7 using System.Linq; 7 using System.Linq;
8 using WixToolset.Data; 8 using WixToolset.Data;
9 using WixToolset.Data.Tuples; 9 using WixToolset.Data.Symbols;
10 using WixToolset.Extensibility; 10 using WixToolset.Extensibility;
11 using WixToolset.Extensibility.Data; 11 using WixToolset.Extensibility.Data;
12 using WixToolset.Extensibility.Services; 12 using WixToolset.Extensibility.Services;
@@ -45,13 +45,13 @@ namespace WixToolset.Core.Bind
45 var fileResolver = new FileResolver(this.BindPaths, this.Extensions); 45 var fileResolver = new FileResolver(this.BindPaths, this.Extensions);
46 46
47 // Build the column lookup only when needed. 47 // Build the column lookup only when needed.
48 Dictionary<string, WixCustomTableColumnTuple> customColumnsById = null; 48 Dictionary<string, WixCustomTableColumnSymbol> customColumnsById = null;
49 49
50 foreach (var sections in this.Intermediate.Sections) 50 foreach (var sections in this.Intermediate.Sections)
51 { 51 {
52 foreach (var tuple in sections.Tuples) 52 foreach (var symbol in sections.Symbols)
53 { 53 {
54 foreach (var field in tuple.Fields) 54 foreach (var field in symbol.Fields)
55 { 55 {
56 if (field.IsNull()) 56 if (field.IsNull())
57 { 57 {
@@ -63,20 +63,20 @@ namespace WixToolset.Core.Bind
63 // Custom table cells require an extra look up to the column definition as the 63 // Custom table cells require an extra look up to the column definition as the
64 // cell's data type is always a string (because strings can store anything) but 64 // cell's data type is always a string (because strings can store anything) but
65 // the column definition may be more specific. 65 // the column definition may be more specific.
66 if (tuple.Definition.Type == TupleDefinitionType.WixCustomTableCell) 66 if (symbol.Definition.Type == SymbolDefinitionType.WixCustomTableCell)
67 { 67 {
68 // We only care about the Data in a CustomTable cell. 68 // We only care about the Data in a CustomTable cell.
69 if (field.Name != nameof(WixCustomTableCellTupleFields.Data)) 69 if (field.Name != nameof(WixCustomTableCellSymbolFields.Data))
70 { 70 {
71 continue; 71 continue;
72 } 72 }
73 73
74 if (customColumnsById == null) 74 if (customColumnsById == null)
75 { 75 {
76 customColumnsById = this.Intermediate.Sections.SelectMany(s => s.Tuples.OfType<WixCustomTableColumnTuple>()).ToDictionary(t => t.Id.Id); 76 customColumnsById = this.Intermediate.Sections.SelectMany(s => s.Symbols.OfType<WixCustomTableColumnSymbol>()).ToDictionary(t => t.Id.Id);
77 } 77 }
78 78
79 if (customColumnsById.TryGetValue(tuple.Fields[(int)WixCustomTableCellTupleFields.TableRef].AsString() + "/" + tuple.Fields[(int)WixCustomTableCellTupleFields.ColumnRef].AsString(), out var customColumn)) 79 if (customColumnsById.TryGetValue(symbol.Fields[(int)WixCustomTableCellSymbolFields.TableRef].AsString() + "/" + symbol.Fields[(int)WixCustomTableCellSymbolFields.ColumnRef].AsString(), out var customColumn))
80 { 80 {
81 fieldType = customColumn.Type; 81 fieldType = customColumn.Type;
82 } 82 }
@@ -93,7 +93,7 @@ namespace WixToolset.Core.Bind
93 var original = field.AsString(); 93 var original = field.AsString();
94 if (!String.IsNullOrEmpty(original)) 94 if (!String.IsNullOrEmpty(original))
95 { 95 {
96 var resolution = this.VariableResolver.ResolveVariables(tuple.SourceLineNumbers, original, !this.AllowUnresolvedVariables); 96 var resolution = this.VariableResolver.ResolveVariables(symbol.SourceLineNumbers, original, !this.AllowUnresolvedVariables);
97 if (resolution.UpdatedValue) 97 if (resolution.UpdatedValue)
98 { 98 {
99 field.Set(resolution.Value); 99 field.Set(resolution.Value);
@@ -101,7 +101,7 @@ namespace WixToolset.Core.Bind
101 101
102 if (resolution.DelayedResolve) 102 if (resolution.DelayedResolve)
103 { 103 {
104 delayedFields.Add(new DelayedField(tuple, field)); 104 delayedFields.Add(new DelayedField(symbol, field));
105 } 105 }
106 106
107 isDefault = resolution.IsDefault; 107 isDefault = resolution.IsDefault;
@@ -109,7 +109,7 @@ namespace WixToolset.Core.Bind
109 } 109 }
110 } 110 }
111 111
112 // Move to next tuple if we've hit an error resolving variables. 112 // Move to next symbol if we've hit an error resolving variables.
113 if (this.Messaging.EncounteredError) // TODO: make this error handling more specific to just the failure to resolve variables in this field. 113 if (this.Messaging.EncounteredError) // TODO: make this error handling more specific to just the failure to resolve variables in this field.
114 { 114 {
115 continue; 115 continue;
@@ -122,7 +122,7 @@ namespace WixToolset.Core.Bind
122 122
123#if TODO_PATCHING 123#if TODO_PATCHING
124 // Skip file resolution if the file is to be deleted. 124 // Skip file resolution if the file is to be deleted.
125 if (RowOperation.Delete == tuple.Operation) 125 if (RowOperation.Delete == symbol.Operation)
126 { 126 {
127 continue; 127 continue;
128 } 128 }
@@ -151,13 +151,13 @@ namespace WixToolset.Core.Bind
151#endif 151#endif
152 152
153 // resolve the path to the file 153 // resolve the path to the file
154 var value = fileResolver.ResolveFile(objectField.Path, tuple.Definition, tuple.SourceLineNumbers, BindStage.Normal); 154 var value = fileResolver.ResolveFile(objectField.Path, symbol.Definition, symbol.SourceLineNumbers, BindStage.Normal);
155 field.Set(value); 155 field.Set(value);
156 } 156 }
157 else if (!fileResolver.RebaseTarget && !fileResolver.RebaseUpdated) // Normal binding for Patch Scenario (normal patch, no re-basing logic) 157 else if (!fileResolver.RebaseTarget && !fileResolver.RebaseUpdated) // Normal binding for Patch Scenario (normal patch, no re-basing logic)
158 { 158 {
159 // resolve the path to the file 159 // resolve the path to the file
160 var value = fileResolver.ResolveFile(objectField.Path, tuple.Definition, tuple.SourceLineNumbers, BindStage.Normal); 160 var value = fileResolver.ResolveFile(objectField.Path, symbol.Definition, symbol.SourceLineNumbers, BindStage.Normal);
161 field.Set(value); 161 field.Set(value);
162 } 162 }
163#if TODO_PATCHING 163#if TODO_PATCHING
@@ -179,7 +179,7 @@ namespace WixToolset.Core.Bind
179 } 179 }
180 } 180 }
181 181
182 objectField.Data = fileResolver.ResolveFile(filePathToResolve, tuple.Definition.Name, tuple.SourceLineNumbers, BindStage.Updated); 182 objectField.Data = fileResolver.ResolveFile(filePathToResolve, symbol.Definition.Name, symbol.SourceLineNumbers, BindStage.Updated);
183 } 183 }
184#endif 184#endif
185 } 185 }
@@ -192,7 +192,7 @@ namespace WixToolset.Core.Bind
192#if TODO_PATCHING 192#if TODO_PATCHING
193 if (null != objectField.PreviousData) 193 if (null != objectField.PreviousData)
194 { 194 {
195 objectField.PreviousData = this.BindVariableResolver.ResolveVariables(tuple.SourceLineNumbers, objectField.PreviousData, false, out isDefault); 195 objectField.PreviousData = this.BindVariableResolver.ResolveVariables(symbol.SourceLineNumbers, objectField.PreviousData, false, out isDefault);
196 196
197 if (!Messaging.Instance.EncounteredError) // TODO: make this error handling more specific to just the failure to resolve variables in this field. 197 if (!Messaging.Instance.EncounteredError) // TODO: make this error handling more specific to just the failure to resolve variables in this field.
198 { 198 {
@@ -217,7 +217,7 @@ namespace WixToolset.Core.Bind
217 if (!fileResolver.RebaseTarget && !fileResolver.RebaseUpdated) 217 if (!fileResolver.RebaseTarget && !fileResolver.RebaseUpdated)
218 { 218 {
219 // resolve the path to the file 219 // resolve the path to the file
220 objectField.PreviousData = fileResolver.ResolveFile((string)objectField.PreviousData, tuple.Definition.Name, tuple.SourceLineNumbers, BindStage.Normal); 220 objectField.PreviousData = fileResolver.ResolveFile((string)objectField.PreviousData, symbol.Definition.Name, symbol.SourceLineNumbers, BindStage.Normal);
221 } 221 }
222 else 222 else
223 { 223 {
@@ -235,14 +235,14 @@ namespace WixToolset.Core.Bind
235 } 235 }
236 236
237 // resolve the path to the file 237 // resolve the path to the file
238 objectField.PreviousData = fileResolver.ResolveFile((string)objectField.PreviousData, tuple.Definition.Name, tuple.SourceLineNumbers, BindStage.Target); 238 objectField.PreviousData = fileResolver.ResolveFile((string)objectField.PreviousData, symbol.Definition.Name, symbol.SourceLineNumbers, BindStage.Target);
239 239
240 } 240 }
241 } 241 }
242 catch (WixFileNotFoundException) 242 catch (WixFileNotFoundException)
243 { 243 {
244 // display the error with source line information 244 // display the error with source line information
245 Messaging.Instance.Write(WixErrors.FileNotFound(tuple.SourceLineNumbers, (string)objectField.PreviousData)); 245 Messaging.Instance.Write(WixErrors.FileNotFound(symbol.SourceLineNumbers, (string)objectField.PreviousData));
246 } 246 }
247 } 247 }
248 } 248 }