Rename Tuple to Symbol
Rob Mensching committed
Jan 4, 2021 at 14:32 UTC
539c7ceb96d787bf485217d51c7a4bcad712b0b3
6 files changed
+128
-128
src/MessagesToMessages/Properties/launchSettings.json
+1
-1
@@ -1,6 +1,6 @@
1
{
2
"profiles": {
3
- "TablesAndTuples": {
3
+ "TablesAndSymbols": {
4
"commandName": "Project",
5
"commandLineArgs": "E:\\src\\wixtoolset\\Core\\src\\WixToolset.Core\\Data\\messages.xml E:\\src\\wixtoolset\\Data\\src\\WixToolset.Data",
6
"workingDirectory": "E:\\src\\wixtoolset\\Core\\src\\WixToolset.Core\\"
src/TablesAndTuples/ColumnDefinitionEnums.cs
+1
-1
@@ -1,4 +1,4 @@
1
-namespace TablesAndTuples
1
+namespace TablesAndSymbols
2
{
3
public enum ColumnCategory
4
{
src/TablesAndTuples/Program.cs
+65
-65
@@ -7,7 +7,7 @@ using System.Text.RegularExpressions;
7
using System.Xml.Linq;
8
using SimpleJson;
9
10
-namespace TablesAndTuples
10
+namespace TablesAndSymbols
11
{
12
class Program
13
{
@@ -65,11 +65,11 @@ namespace TablesAndTuples
65
66
foreach (var tableDefinition in tableDefinitions)
67
{
68
- if (tableDefinition.Tupleless)
68
+ if (tableDefinition.Symbolless)
69
{
70
continue;
71
}
72
- var tupleType = tableDefinition.TupleDefinitionName;
72
+ var symbolType = tableDefinition.SymbolDefinitionName;
73
74
var fields = new JsonArray();
75
var firstField = true;
@@ -79,7 +79,7 @@ namespace TablesAndTuples
79
if (firstField)
80
{
81
firstField = false;
82
- if (tableDefinition.TupleIdIsPrimaryKey)
82
+ if (tableDefinition.SymbolIdIsPrimaryKey)
83
{
84
continue;
85
}
@@ -121,12 +121,12 @@ namespace TablesAndTuples
121
122
var obj = new JsonObject
123
{
124
- { tupleType, fields }
124
+ { symbolType, fields }
125
};
126
array.Add(obj);
127
}
128
129
- array.Sort(CompareTupleDefinitions);
129
+ array.Sort(CompareSymbolDefinitions);
130
131
var strat = new PocoJsonSerializerStrategy();
132
var json = SimpleJson.SimpleJson.SerializeObject(array, strat);
@@ -147,28 +147,28 @@ namespace TablesAndTuples
147
private static void ReadJsonWriteCs(string inputPath, string outputFolder, string prefix)
148
{
149
var json = File.ReadAllText(inputPath);
150
- var tuples = SimpleJson.SimpleJson.DeserializeObject(json) as JsonArray;
150
+ var symbols = SimpleJson.SimpleJson.DeserializeObject(json) as JsonArray;
151
152
- var tupleNames = new List<string>();
152
+ var symbolNames = new List<string>();
153
154
- foreach (var tupleDefinition in tuples.Cast<JsonObject>())
154
+ foreach (var symbolDefinition in symbols.Cast<JsonObject>())
155
{
156
- var tupleName = tupleDefinition.Keys.Single();
157
- var fields = tupleDefinition.Values.Single() as JsonArray;
156
+ var symbolName = symbolDefinition.Keys.Single();
157
+ var fields = symbolDefinition.Values.Single() as JsonArray;
158
159
var list = GetFields(fields).ToList();
160
161
- tupleNames.Add(tupleName);
161
+ symbolNames.Add(symbolName);
162
163
- var text = GenerateTupleFileText(prefix, tupleName, list);
163
+ var text = GenerateSymbolFileText(prefix, symbolName, list);
164
165
- var pathTuple = Path.Combine(outputFolder, tupleName + "Tuple.cs");
166
- Console.WriteLine("Writing: {0}", pathTuple);
167
- File.WriteAllText(pathTuple, text);
165
+ var pathSymbol = Path.Combine(outputFolder, symbolName + "Symbol.cs");
166
+ Console.WriteLine("Writing: {0}", pathSymbol);
167
+ File.WriteAllText(pathSymbol, text);
168
}
169
170
- var content = TupleNamesFileContent(prefix, tupleNames);
171
- var pathNames = Path.Combine(outputFolder, String.Concat(prefix, "TupleDefinitions.cs"));
170
+ var content = SymbolNamesFileContent(prefix, symbolNames);
171
+ var pathNames = Path.Combine(outputFolder, String.Concat(prefix, "SymbolDefinitions.cs"));
172
Console.WriteLine("Writing: {0}", pathNames);
173
File.WriteAllText(pathNames, content);
174
}
@@ -215,7 +215,7 @@ namespace TablesAndTuples
215
var unrealDef =
216
" unreal: true,";
217
var endTableDef = String.Join(Environment.NewLine,
218
- " tupleIdIsPrimaryKey: {1}",
218
+ " symbolIdIsPrimaryKey: {1}",
219
" );",
220
"");
221
var startAllTablesDef = String.Join(Environment.NewLine,
@@ -234,8 +234,8 @@ namespace TablesAndTuples
234
sb.AppendLine(startClassDef.Replace("{1}", ns).Replace("{2}", prefix));
235
foreach (var tableDefinition in tableDefinitions)
236
{
237
- var tupleDefinition = tableDefinition.Tupleless ? "null" : $"{prefix}TupleDefinitions.{tableDefinition.TupleDefinitionName}";
238
- sb.AppendLine(startTableDef.Replace("{1}", tableDefinition.VariableName).Replace("{2}", tableDefinition.Name).Replace("{3}", tupleDefinition));
237
+ var symbolDefinition = tableDefinition.Symbolless ? "null" : $"{prefix}SymbolDefinitions.{tableDefinition.SymbolDefinitionName}";
238
+ sb.AppendLine(startTableDef.Replace("{1}", tableDefinition.VariableName).Replace("{2}", tableDefinition.Name).Replace("{3}", symbolDefinition));
239
foreach (var columnDefinition in tableDefinition.Columns)
240
{
241
sb.Append(columnDef.Replace("{1}", columnDefinition.Name).Replace("{2}", columnDefinition.Type.ToString()).Replace("{3}", columnDefinition.Length.ToString())
@@ -287,7 +287,7 @@ namespace TablesAndTuples
287
{
288
sb.AppendLine(unrealDef);
289
}
290
- sb.AppendLine(endTableDef.Replace("{1}", tableDefinition.TupleIdIsPrimaryKey.ToString().ToLower()));
290
+ sb.AppendLine(endTableDef.Replace("{1}", tableDefinition.SymbolIdIsPrimaryKey.ToString().ToLower()));
291
}
292
sb.AppendLine(startAllTablesDef);
293
foreach (var tableDefinition in tableDefinitions)
@@ -300,7 +300,7 @@ namespace TablesAndTuples
300
return sb.ToString();
301
}
302
303
- private static string GenerateTupleFileText(string prefix, string tupleName, List<(string Name, string Type, string ClrType, string AsFunction)> tupleFields)
303
+ private static string GenerateSymbolFileText(string prefix, string symbolName, List<(string Name, string Type, string ClrType, string AsFunction)> symbolFields)
304
{
305
var ns = prefix ?? "Data";
306
var toString = String.IsNullOrEmpty(prefix) ? null : ".ToString()";
@@ -312,52 +312,52 @@ namespace TablesAndTuples
312
"{");
313
var usingDataDef =
314
" using WixToolset.Data;";
315
- var startTupleDef = String.Join(Environment.NewLine,
316
- " using WixToolset.{2}.Tuples;",
315
+ var startSymbolDef = String.Join(Environment.NewLine,
316
+ " using WixToolset.{2}.Symbols;",
317
"",
318
- " public static partial class {3}TupleDefinitions",
318
+ " public static partial class {3}SymbolDefinitions",
319
" {",
320
- " public static readonly IntermediateTupleDefinition {1} = new IntermediateTupleDefinition(",
321
- " {3}TupleDefinitionType.{1}{4},",
320
+ " public static readonly IntermediateSymbolDefinition {1} = new IntermediateSymbolDefinition(",
321
+ " {3}SymbolDefinitionType.{1}{4},",
322
" new{5}[]",
323
" {");
324
var fieldDef =
325
- " new IntermediateFieldDefinition(nameof({1}TupleFields.{2}), IntermediateFieldType.{3}),";
326
- var endTupleDef = String.Join(Environment.NewLine,
325
+ " new IntermediateFieldDefinition(nameof({1}SymbolFields.{2}), IntermediateFieldType.{3}),";
326
+ var endSymbolDef = String.Join(Environment.NewLine,
327
" },",
328
- " typeof({1}Tuple));",
328
+ " typeof({1}Symbol));",
329
" }",
330
"}",
331
"",
332
- "namespace WixToolset.{2}.Tuples",
332
+ "namespace WixToolset.{2}.Symbols",
333
"{");
334
var startEnumDef = String.Join(Environment.NewLine,
335
- " public enum {1}TupleFields",
335
+ " public enum {1}SymbolFields",
336
" {");
337
var fieldEnum =
338
" {2},";
339
- var startTuple = String.Join(Environment.NewLine,
339
+ var startSymbol = String.Join(Environment.NewLine,
340
" }",
341
"",
342
- " public class {1}Tuple : IntermediateTuple",
342
+ " public class {1}Symbol : IntermediateSymbol",
343
" {",
344
- " public {1}Tuple() : base({3}TupleDefinitions.{1}, null, null)",
344
+ " public {1}Symbol() : base({3}SymbolDefinitions.{1}, null, null)",
345
" {",
346
" }",
347
"",
348
- " public {1}Tuple(SourceLineNumber sourceLineNumber, Identifier id = null) : base({3}TupleDefinitions.{1}, sourceLineNumber, id)",
348
+ " public {1}Symbol(SourceLineNumber sourceLineNumber, Identifier id = null) : base({3}SymbolDefinitions.{1}, sourceLineNumber, id)",
349
" {",
350
" }",
351
"",
352
- " public IntermediateField this[{1}TupleFields index] => this.Fields[(int)index];");
352
+ " public IntermediateField this[{1}SymbolFields index] => this.Fields[(int)index];");
353
var fieldProp = String.Join(Environment.NewLine,
354
"",
355
" public {4} {2}",
356
" {",
357
- " get => {6}this.Fields[(int){1}TupleFields.{2}]{5};",
358
- " set => this.Set((int){1}TupleFields.{2}, value);",
357
+ " get => {6}this.Fields[(int){1}SymbolFields.{2}]{5};",
358
+ " set => this.Set((int){1}SymbolFields.{2}, value);",
359
" }");
360
- var endTuple = String.Join(Environment.NewLine,
360
+ var endSymbol = String.Join(Environment.NewLine,
361
" }",
362
"}");
363
@@ -368,36 +368,36 @@ namespace TablesAndTuples
368
{
369
sb.AppendLine(usingDataDef);
370
}
371
- sb.AppendLine(startTupleDef.Replace("{1}", tupleName).Replace("{2}", ns).Replace("{3}", prefix).Replace("{4}", toString).Replace("{5}", tupleFields.Any() ? null : " IntermediateFieldDefinition"));
372
- foreach (var field in tupleFields)
371
+ sb.AppendLine(startSymbolDef.Replace("{1}", symbolName).Replace("{2}", ns).Replace("{3}", prefix).Replace("{4}", toString).Replace("{5}", symbolFields.Any() ? null : " IntermediateFieldDefinition"));
372
+ foreach (var field in symbolFields)
373
{
374
- sb.AppendLine(fieldDef.Replace("{1}", tupleName).Replace("{2}", field.Name).Replace("{3}", field.Type));
374
+ sb.AppendLine(fieldDef.Replace("{1}", symbolName).Replace("{2}", field.Name).Replace("{3}", field.Type));
375
}
376
- sb.AppendLine(endTupleDef.Replace("{1}", tupleName).Replace("{2}", ns).Replace("{3}", prefix));
376
+ sb.AppendLine(endSymbolDef.Replace("{1}", symbolName).Replace("{2}", ns).Replace("{3}", prefix));
377
if (ns != "Data")
378
{
379
sb.AppendLine(usingDataDef);
380
sb.AppendLine();
381
}
382
- sb.AppendLine(startEnumDef.Replace("{1}", tupleName));
383
- foreach (var field in tupleFields)
382
+ sb.AppendLine(startEnumDef.Replace("{1}", symbolName));
383
+ foreach (var field in symbolFields)
384
{
385
- sb.AppendLine(fieldEnum.Replace("{1}", tupleName).Replace("{2}", field.Name));
385
+ sb.AppendLine(fieldEnum.Replace("{1}", symbolName).Replace("{2}", field.Name));
386
}
387
- sb.AppendLine(startTuple.Replace("{1}", tupleName).Replace("{2}", ns).Replace("{3}", prefix));
388
- foreach (var field in tupleFields)
387
+ sb.AppendLine(startSymbol.Replace("{1}", symbolName).Replace("{2}", ns).Replace("{3}", prefix));
388
+ foreach (var field in symbolFields)
389
{
390
var useCast = ns == "Data" && field.AsFunction != "AsPath()";
391
var cast = useCast ? $"({field.ClrType})" : null;
392
var asFunction = useCast ? null : $".{field.AsFunction}";
393
- sb.AppendLine(fieldProp.Replace("{1}", tupleName).Replace("{2}", field.Name).Replace("{3}", field.Type).Replace("{4}", field.ClrType).Replace("{5}", asFunction).Replace("{6}", cast));
393
+ sb.AppendLine(fieldProp.Replace("{1}", symbolName).Replace("{2}", field.Name).Replace("{3}", field.Type).Replace("{4}", field.ClrType).Replace("{5}", asFunction).Replace("{6}", cast));
394
}
395
- sb.Append(endTuple);
395
+ sb.Append(endSymbol);
396
397
return sb.ToString();
398
}
399
400
- private static string TupleNamesFileContent(string prefix, List<string> tupleNames)
400
+ private static string SymbolNamesFileContent(string prefix, List<string> symbolNames)
401
{
402
var ns = prefix ?? "Data";
403
@@ -409,20 +409,20 @@ namespace TablesAndTuples
409
" using System;",
410
" using WixToolset.Data;",
411
"",
412
- " public enum {3}TupleDefinitionType",
412
+ " public enum {3}SymbolDefinitionType",
413
" {");
414
var namesFormat =
415
" {1},";
416
var midpoint = String.Join(Environment.NewLine,
417
" }",
418
"",
419
- " public static partial class {3}TupleDefinitions",
419
+ " public static partial class {3}SymbolDefinitions",
420
" {",
421
" public static readonly Version Version = new Version(\"4.0.0\");",
422
"",
423
- " public static IntermediateTupleDefinition ByName(string name)",
423
+ " public static IntermediateSymbolDefinition ByName(string name)",
424
" {",
425
- " if (!Enum.TryParse(name, out {3}TupleDefinitionType type))",
425
+ " if (!Enum.TryParse(name, out {3}SymbolDefinitionType type))",
426
" {",
427
" return null;",
428
" }",
@@ -430,14 +430,14 @@ namespace TablesAndTuples
430
" return ByType(type);",
431
" }",
432
"",
433
- " public static IntermediateTupleDefinition ByType({3}TupleDefinitionType type)",
433
+ " public static IntermediateSymbolDefinition ByType({3}SymbolDefinitionType type)",
434
" {",
435
" switch (type)",
436
" {");
437
438
var caseFormat = String.Join(Environment.NewLine,
439
- " case {3}TupleDefinitionType.{1}:",
440
- " return {3}TupleDefinitions.{1};",
439
+ " case {3}SymbolDefinitionType.{1}:",
440
+ " return {3}SymbolDefinitions.{1};",
441
"");
442
443
var footer = String.Join(Environment.NewLine,
@@ -451,14 +451,14 @@ namespace TablesAndTuples
451
var sb = new StringBuilder();
452
453
sb.AppendLine(header.Replace("{2}", ns).Replace("{3}", prefix));
454
- foreach (var tupleName in tupleNames)
454
+ foreach (var symbolName in symbolNames)
455
{
456
- sb.AppendLine(namesFormat.Replace("{1}", tupleName).Replace("{2}", ns).Replace("{3}", prefix));
456
+ sb.AppendLine(namesFormat.Replace("{1}", symbolName).Replace("{2}", ns).Replace("{3}", prefix));
457
}
458
sb.AppendLine(midpoint.Replace("{2}", ns).Replace("{3}", prefix));
459
- foreach (var tupleName in tupleNames)
459
+ foreach (var symbolName in symbolNames)
460
{
461
- sb.AppendLine(caseFormat.Replace("{1}", tupleName).Replace("{2}", ns).Replace("{3}", prefix));
461
+ sb.AppendLine(caseFormat.Replace("{1}", symbolName).Replace("{2}", ns).Replace("{3}", prefix));
462
}
463
sb.AppendLine(footer);
464
@@ -514,7 +514,7 @@ namespace TablesAndTuples
514
throw new ArgumentException(fieldType);
515
}
516
517
- private static int CompareTupleDefinitions(object x, object y)
517
+ private static int CompareSymbolDefinitions(object x, object y)
518
{
519
var first = (JsonObject)x;
520
var second = (JsonObject)y;
src/TablesAndTuples/WixColumnDefinition.cs
+1
-1
@@ -1,7 +1,7 @@
1
using System;
2
using System.Xml;
3
4
-namespace TablesAndTuples
4
+namespace TablesAndSymbols
5
{
6
class WixColumnDefinition
7
{
src/TablesAndTuples/WixTableDefinition.cs
+19
-19
@@ -2,43 +2,43 @@ using System.Collections.Generic;
2
using System.Linq;
3
using System.Xml;
4
5
-namespace TablesAndTuples
5
+namespace TablesAndSymbols
6
{
7
class WixTableDefinition
8
{
9
- public WixTableDefinition(string name, IEnumerable<WixColumnDefinition> columns, bool unreal, bool tupleless, string tupleDefinitionName, bool? tupleIdIsPrimaryKey)
9
+ public WixTableDefinition(string name, IEnumerable<WixColumnDefinition> columns, bool unreal, bool symbolless, string symbolDefinitionName, bool? symbolIdIsPrimaryKey)
10
{
11
this.Name = name;
12
this.VariableName = name.Replace("_", "");
13
this.Unreal = unreal;
14
this.Columns = columns?.ToArray();
15
- this.Tupleless = tupleless;
16
- this.TupleDefinitionName = tupleless ? null : tupleDefinitionName ?? this.VariableName;
17
- this.TupleIdIsPrimaryKey = tupleIdIsPrimaryKey ?? DeriveTupleIdIsPrimaryKey(this.Columns);
15
+ this.Symbolless = symbolless;
16
+ this.SymbolDefinitionName = symbolless ? null : symbolDefinitionName ?? this.VariableName;
17
+ this.SymbolIdIsPrimaryKey = symbolIdIsPrimaryKey ?? DeriveSymbolIdIsPrimaryKey(this.Columns);
18
}
19
20
public string Name { get; }
21
22
public string VariableName { get; }
23
24
- public string TupleDefinitionName { get; }
24
+ public string SymbolDefinitionName { get; }
25
26
public bool Unreal { get; }
27
28
public WixColumnDefinition[] Columns { get; }
29
30
- public bool TupleIdIsPrimaryKey { get; }
30
+ public bool SymbolIdIsPrimaryKey { get; }
31
32
- public bool Tupleless { get; }
32
+ public bool Symbolless { get; }
33
34
static WixTableDefinition Read(XmlReader reader)
35
{
36
var empty = reader.IsEmptyElement;
37
string name = null;
38
- string tupleDefinitionName = null;
38
+ string symbolDefinitionName = null;
39
var unreal = false;
40
- bool? tupleIdIsPrimaryKey = null;
41
- var tupleless = false;
40
+ bool? symbolIdIsPrimaryKey = null;
41
+ var symbolless = false;
42
43
while (reader.MoveToNextAttribute())
44
{
@@ -47,14 +47,14 @@ namespace TablesAndTuples
47
case "name":
48
name = reader.Value;
49
break;
50
- case "tupleDefinitionName":
51
- tupleDefinitionName = reader.Value;
50
+ case "symbolDefinitionName":
51
+ symbolDefinitionName = reader.Value;
52
break;
53
- case "tupleIdIsPrimaryKey":
54
- tupleIdIsPrimaryKey = reader.Value.Equals("yes");
53
+ case "symbolIdIsPrimaryKey":
54
+ symbolIdIsPrimaryKey = reader.Value.Equals("yes");
55
break;
56
- case "tupleless":
57
- tupleless = reader.Value.Equals("yes");
56
+ case "symbolless":
57
+ symbolless = reader.Value.Equals("yes");
58
break;
59
case "unreal":
60
unreal = reader.Value.Equals("yes");
@@ -101,10 +101,10 @@ namespace TablesAndTuples
101
}
102
}
103
104
- return new WixTableDefinition(name, columns.ToArray(), unreal, tupleless, tupleDefinitionName, tupleIdIsPrimaryKey);
104
+ return new WixTableDefinition(name, columns.ToArray(), unreal, symbolless, symbolDefinitionName, symbolIdIsPrimaryKey);
105
}
106
107
- static bool DeriveTupleIdIsPrimaryKey(WixColumnDefinition[] columns)
107
+ static bool DeriveSymbolIdIsPrimaryKey(WixColumnDefinition[] columns)
108
{
109
return columns[0].PrimaryKey &&
110
columns[0].Type == ColumnType.String &&
src/WixBuildTools.XsdGen/ElementCollection.cs
+41
-41
@@ -111,7 +111,7 @@ namespace WixToolset.Serialize
111
if (collectionItem.ElementType.IsAssignableFrom(element.GetType()))
112
{
113
collectionItem.AddElement(element);
114
-
114
+
115
if (!containerUsed)
116
{
117
this.containersUsed++;
@@ -176,7 +176,7 @@ namespace WixToolset.Serialize
176
}
177
178
collectionItem.RemoveElement(element);
179
-
179
+
180
if (collectionItem.Elements.Count == 0)
181
{
182
this.containersUsed--;
@@ -277,7 +277,7 @@ namespace WixToolset.Serialize
277
{
278
return nestedFilter;
279
}
280
-
280
+
281
continue;
282
}
283
}
@@ -353,10 +353,10 @@ namespace WixToolset.Serialize
353
{
354
throw new ArgumentException(
355
String.Format(
356
- CultureInfo.InvariantCulture,
357
- "Element must be a subclass of {0}, but was of type {1}.",
358
- this.elementType.Name,
359
- element.GetType().Name),
356
+ CultureInfo.InvariantCulture,
357
+ "Element must be a subclass of {0}, but was of type {1}.",
358
+ this.elementType.Name,
359
+ element.GetType().Name),
360
"element");
361
}
362
@@ -374,10 +374,10 @@ namespace WixToolset.Serialize
374
{
375
throw new ArgumentException(
376
String.Format(
377
- CultureInfo.InvariantCulture,
378
- "Element must be a subclass of {0}, but was of type {1}.",
379
- this.elementType.Name,
380
- element.GetType().Name),
377
+ CultureInfo.InvariantCulture,
378
+ "Element must be a subclass of {0}, but was of type {1}.",
379
+ this.elementType.Name,
380
+ element.GetType().Name),
381
"element");
382
}
383
@@ -454,13 +454,13 @@ namespace WixToolset.Serialize
454
{
455
if (this.collectionStack != null && this.collectionStack.Count > 0)
456
{
457
- CollectionTuple tuple = (CollectionTuple)this.collectionStack.Peek();
458
- object container = tuple.Collection.items[tuple.ContainerIndex];
459
-
457
+ CollectionSymbol symbol = (CollectionSymbol)this.collectionStack.Peek();
458
+ object container = symbol.Collection.items[symbol.ContainerIndex];
459
+
460
CollectionItem collectionItem = container as CollectionItem;
461
if (collectionItem != null)
462
{
463
- return collectionItem.Elements[tuple.ItemIndex];
463
+ return collectionItem.Elements[symbol.ItemIndex];
464
}
465
466
throw new InvalidOperationException(String.Format(
@@ -499,12 +499,12 @@ namespace WixToolset.Serialize
499
}
500
501
this.collectionStack = new Stack();
502
- this.collectionStack.Push(new CollectionTuple(this.collection));
502
+ this.collectionStack.Push(new CollectionSymbol(this.collection));
503
}
504
505
- CollectionTuple tuple = (CollectionTuple)this.collectionStack.Peek();
505
+ CollectionSymbol symbol = (CollectionSymbol)this.collectionStack.Peek();
506
507
- if (this.FindNext(tuple))
507
+ if (this.FindNext(symbol))
508
{
509
return true;
510
}
@@ -532,50 +532,50 @@ namespace WixToolset.Serialize
532
collection.Count));
533
}
534
535
- CollectionTuple tuple = new CollectionTuple(collection);
536
- this.collectionStack.Push(tuple);
537
- this.FindNext(tuple);
535
+ CollectionSymbol symbol = new CollectionSymbol(collection);
536
+ this.collectionStack.Push(symbol);
537
+ this.FindNext(symbol);
538
}
539
540
/// <summary>
541
- /// Finds the next item from a given tuple.
541
+ /// Finds the next item from a given symbol.
542
/// </summary>
543
- /// <param name="tuple">The tuple to start looking from.</param>
543
+ /// <param name="symbol">The symbol to start looking from.</param>
544
/// <returns>True if a next element is found, false otherwise.</returns>
545
- private bool FindNext(CollectionTuple tuple)
545
+ private bool FindNext(CollectionSymbol symbol)
546
{
547
- object container = tuple.Collection.items[tuple.ContainerIndex];
548
-
547
+ object container = symbol.Collection.items[symbol.ContainerIndex];
548
+
549
CollectionItem collectionItem = container as CollectionItem;
550
if (collectionItem != null)
551
{
552
- if (tuple.ItemIndex + 1 < collectionItem.Elements.Count)
552
+ if (symbol.ItemIndex + 1 < collectionItem.Elements.Count)
553
{
554
- tuple.ItemIndex++;
554
+ symbol.ItemIndex++;
555
return true;
556
}
557
}
558
559
ElementCollection elementCollection = container as ElementCollection;
560
- if (elementCollection != null && elementCollection.Count > 0 && tuple.ItemIndex == -1)
560
+ if (elementCollection != null && elementCollection.Count > 0 && symbol.ItemIndex == -1)
561
{
562
- tuple.ItemIndex++;
562
+ symbol.ItemIndex++;
563
this.PushCollection(elementCollection);
564
return true;
565
}
566
567
- tuple.ItemIndex = 0;
567
+ symbol.ItemIndex = 0;
568
569
- for (int i = tuple.ContainerIndex + 1; i < tuple.Collection.items.Count; ++i)
569
+ for (int i = symbol.ContainerIndex + 1; i < symbol.Collection.items.Count; ++i)
570
{
571
- object nestedContainer = tuple.Collection.items[i];
572
-
571
+ object nestedContainer = symbol.Collection.items[i];
572
+
573
CollectionItem nestedCollectionItem = nestedContainer as CollectionItem;
574
if (nestedCollectionItem != null)
575
{
576
if (nestedCollectionItem.Elements.Count > 0)
577
{
578
- tuple.ContainerIndex = i;
578
+ symbol.ContainerIndex = i;
579
return true;
580
}
581
}
@@ -583,7 +583,7 @@ namespace WixToolset.Serialize
583
ElementCollection nestedElementCollection = nestedContainer as ElementCollection;
584
if (nestedElementCollection != null && nestedElementCollection.Count > 0)
585
{
586
- tuple.ContainerIndex = i;
586
+ symbol.ContainerIndex = i;
587
this.PushCollection(nestedElementCollection);
588
return true;
589
}
@@ -596,23 +596,23 @@ namespace WixToolset.Serialize
596
/// Class representing a single point in the collection. Consists of an ElementCollection,
597
/// a container index, and an index into the container.
598
/// </summary>
599
- private class CollectionTuple
599
+ private class CollectionSymbol
600
{
601
private ElementCollection collection;
602
private int containerIndex;
603
private int itemIndex = -1;
604
605
/// <summary>
606
- /// Creates a new CollectionTuple.
606
+ /// Creates a new CollectionSymbol.
607
/// </summary>
608
- /// <param name="collection">The collection for the tuple.</param>
609
- public CollectionTuple(ElementCollection collection)
608
+ /// <param name="collection">The collection for the symbol.</param>
609
+ public CollectionSymbol(ElementCollection collection)
610
{
611
this.collection = collection;
612
}
613
614
/// <summary>
615
- /// Gets the collection for the tuple.
615
+ /// Gets the collection for the symbol.
616
/// </summary>
617
public ElementCollection Collection
618
{