aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRob Mensching <rob@firegiant.com>2019-10-18 11:28:14 -0700
committerRob Mensching <rob@firegiant.com>2019-10-18 11:29:59 -0700
commitcf6531a216dc248177116399120f02d67731f312 (patch)
treef09e4dd37dcd399758fdb82e23f0eeeb1f9e528e
parentc5bae04ebcf3cae706ca3bc2717ff3d59ec04824 (diff)
downloadwix-cf6531a216dc248177116399120f02d67731f312.tar.gz
wix-cf6531a216dc248177116399120f02d67731f312.tar.bz2
wix-cf6531a216dc248177116399120f02d67731f312.zip
Small fixes to tuples
-rw-r--r--src/WixToolset.Data/IntermediateTupleExtensions.cs25
-rw-r--r--src/WixToolset.Data/Tuples/ClassTuple.cs4
-rw-r--r--src/WixToolset.Data/Tuples/TextStyleTuple.cs44
3 files changed, 33 insertions, 40 deletions
diff --git a/src/WixToolset.Data/IntermediateTupleExtensions.cs b/src/WixToolset.Data/IntermediateTupleExtensions.cs
index dd488dc5..7fb2a6c3 100644
--- a/src/WixToolset.Data/IntermediateTupleExtensions.cs
+++ b/src/WixToolset.Data/IntermediateTupleExtensions.cs
@@ -16,11 +16,6 @@ namespace WixToolset.Data
16 16
17 public static IntermediateField Set(this IntermediateTuple tuple, int index, bool value) 17 public static IntermediateField Set(this IntermediateTuple tuple, int index, bool value)
18 { 18 {
19 if (value == default && NoFieldMetadata(tuple, index))
20 {
21 return tuple.Fields[index] = null;
22 }
23
24 var definition = tuple.Definition.FieldDefinitions[index]; 19 var definition = tuple.Definition.FieldDefinitions[index];
25 20
26 var field = tuple.Fields[index].Set(definition, value); 21 var field = tuple.Fields[index].Set(definition, value);
@@ -30,7 +25,7 @@ namespace WixToolset.Data
30 25
31 public static IntermediateField Set(this IntermediateTuple tuple, int index, bool? value) 26 public static IntermediateField Set(this IntermediateTuple tuple, int index, bool? value)
32 { 27 {
33 if (value == default && NoFieldMetadata(tuple, index)) 28 if (value == null && NoFieldMetadata(tuple, index))
34 { 29 {
35 return tuple.Fields[index] = null; 30 return tuple.Fields[index] = null;
36 } 31 }
@@ -44,11 +39,6 @@ namespace WixToolset.Data
44 39
45 public static IntermediateField Set(this IntermediateTuple tuple, int index, long value) 40 public static IntermediateField Set(this IntermediateTuple tuple, int index, long value)
46 { 41 {
47 if (value == default && NoFieldMetadata(tuple, index))
48 {
49 return tuple.Fields[index] = null;
50 }
51
52 var definition = tuple.Definition.FieldDefinitions[index]; 42 var definition = tuple.Definition.FieldDefinitions[index];
53 43
54 var field = tuple.Fields[index].Set(definition, value); 44 var field = tuple.Fields[index].Set(definition, value);
@@ -58,7 +48,7 @@ namespace WixToolset.Data
58 48
59 public static IntermediateField Set(this IntermediateTuple tuple, int index, long? value) 49 public static IntermediateField Set(this IntermediateTuple tuple, int index, long? value)
60 { 50 {
61 if (value == default && NoFieldMetadata(tuple, index)) 51 if (value == null && NoFieldMetadata(tuple, index))
62 { 52 {
63 return tuple.Fields[index] = null; 53 return tuple.Fields[index] = null;
64 } 54 }
@@ -72,11 +62,6 @@ namespace WixToolset.Data
72 62
73 public static IntermediateField Set(this IntermediateTuple tuple, int index, int value) 63 public static IntermediateField Set(this IntermediateTuple tuple, int index, int value)
74 { 64 {
75 if (value == default && NoFieldMetadata(tuple, index))
76 {
77 return tuple.Fields[index] = null;
78 }
79
80 var definition = tuple.Definition.FieldDefinitions[index]; 65 var definition = tuple.Definition.FieldDefinitions[index];
81 66
82 var field = tuple.Fields[index].Set(definition, value); 67 var field = tuple.Fields[index].Set(definition, value);
@@ -86,7 +71,7 @@ namespace WixToolset.Data
86 71
87 public static IntermediateField Set(this IntermediateTuple tuple, int index, int? value) 72 public static IntermediateField Set(this IntermediateTuple tuple, int index, int? value)
88 { 73 {
89 if (value == default && NoFieldMetadata(tuple, index)) 74 if (value == null && NoFieldMetadata(tuple, index))
90 { 75 {
91 return tuple.Fields[index] = null; 76 return tuple.Fields[index] = null;
92 } 77 }
@@ -100,7 +85,7 @@ namespace WixToolset.Data
100 85
101 public static IntermediateField Set(this IntermediateTuple tuple, int index, IntermediateFieldPathValue value) 86 public static IntermediateField Set(this IntermediateTuple tuple, int index, IntermediateFieldPathValue value)
102 { 87 {
103 if (value == default && NoFieldMetadata(tuple, index)) 88 if (value == null && NoFieldMetadata(tuple, index))
104 { 89 {
105 return tuple.Fields[index] = null; 90 return tuple.Fields[index] = null;
106 } 91 }
@@ -114,7 +99,7 @@ namespace WixToolset.Data
114 99
115 public static IntermediateField Set(this IntermediateTuple tuple, int index, string value) 100 public static IntermediateField Set(this IntermediateTuple tuple, int index, string value)
116 { 101 {
117 if (value == default && NoFieldMetadata(tuple, index)) 102 if (value == null && NoFieldMetadata(tuple, index))
118 { 103 {
119 return tuple.Fields[index] = null; 104 return tuple.Fields[index] = null;
120 } 105 }
diff --git a/src/WixToolset.Data/Tuples/ClassTuple.cs b/src/WixToolset.Data/Tuples/ClassTuple.cs
index 5e40fe35..a5ff89e8 100644
--- a/src/WixToolset.Data/Tuples/ClassTuple.cs
+++ b/src/WixToolset.Data/Tuples/ClassTuple.cs
@@ -107,9 +107,9 @@ namespace WixToolset.Data.Tuples
107 set => this.Set((int)ClassTupleFields.IconRef, value); 107 set => this.Set((int)ClassTupleFields.IconRef, value);
108 } 108 }
109 109
110 public int IconIndex 110 public int? IconIndex
111 { 111 {
112 get => (int)this.Fields[(int)ClassTupleFields.IconIndex]; 112 get => (int?)this.Fields[(int)ClassTupleFields.IconIndex];
113 set => this.Set((int)ClassTupleFields.IconIndex, value); 113 set => this.Set((int)ClassTupleFields.IconIndex, value);
114 } 114 }
115 115
diff --git a/src/WixToolset.Data/Tuples/TextStyleTuple.cs b/src/WixToolset.Data/Tuples/TextStyleTuple.cs
index e4929ccf..3614808e 100644
--- a/src/WixToolset.Data/Tuples/TextStyleTuple.cs
+++ b/src/WixToolset.Data/Tuples/TextStyleTuple.cs
@@ -10,10 +10,11 @@ namespace WixToolset.Data
10 TupleDefinitionType.TextStyle, 10 TupleDefinitionType.TextStyle,
11 new[] 11 new[]
12 { 12 {
13 new IntermediateFieldDefinition(nameof(TextStyleTupleFields.TextStyle), IntermediateFieldType.String),
14 new IntermediateFieldDefinition(nameof(TextStyleTupleFields.FaceName), IntermediateFieldType.String), 13 new IntermediateFieldDefinition(nameof(TextStyleTupleFields.FaceName), IntermediateFieldType.String),
15 new IntermediateFieldDefinition(nameof(TextStyleTupleFields.Size), IntermediateFieldType.Number), 14 new IntermediateFieldDefinition(nameof(TextStyleTupleFields.Size), IntermediateFieldType.Number),
16 new IntermediateFieldDefinition(nameof(TextStyleTupleFields.Color), IntermediateFieldType.Number), 15 new IntermediateFieldDefinition(nameof(TextStyleTupleFields.Red), IntermediateFieldType.Number),
16 new IntermediateFieldDefinition(nameof(TextStyleTupleFields.Green), IntermediateFieldType.Number),
17 new IntermediateFieldDefinition(nameof(TextStyleTupleFields.Blue), IntermediateFieldType.Number),
17 new IntermediateFieldDefinition(nameof(TextStyleTupleFields.Bold), IntermediateFieldType.Bool), 18 new IntermediateFieldDefinition(nameof(TextStyleTupleFields.Bold), IntermediateFieldType.Bool),
18 new IntermediateFieldDefinition(nameof(TextStyleTupleFields.Italic), IntermediateFieldType.Bool), 19 new IntermediateFieldDefinition(nameof(TextStyleTupleFields.Italic), IntermediateFieldType.Bool),
19 new IntermediateFieldDefinition(nameof(TextStyleTupleFields.Strike), IntermediateFieldType.Bool), 20 new IntermediateFieldDefinition(nameof(TextStyleTupleFields.Strike), IntermediateFieldType.Bool),
@@ -27,10 +28,11 @@ namespace WixToolset.Data.Tuples
27{ 28{
28 public enum TextStyleTupleFields 29 public enum TextStyleTupleFields
29 { 30 {
30 TextStyle,
31 FaceName, 31 FaceName,
32 Size, 32 Size,
33 Color, 33 Red,
34 Green,
35 Blue,
34 Bold, 36 Bold,
35 Italic, 37 Italic,
36 Strike, 38 Strike,
@@ -49,12 +51,6 @@ namespace WixToolset.Data.Tuples
49 51
50 public IntermediateField this[TextStyleTupleFields index] => this.Fields[(int)index]; 52 public IntermediateField this[TextStyleTupleFields index] => this.Fields[(int)index];
51 53
52 public string TextStyle
53 {
54 get => (string)this.Fields[(int)TextStyleTupleFields.TextStyle];
55 set => this.Set((int)TextStyleTupleFields.TextStyle, value);
56 }
57
58 public string FaceName 54 public string FaceName
59 { 55 {
60 get => (string)this.Fields[(int)TextStyleTupleFields.FaceName]; 56 get => (string)this.Fields[(int)TextStyleTupleFields.FaceName];
@@ -63,37 +59,49 @@ namespace WixToolset.Data.Tuples
63 59
64 public int Size 60 public int Size
65 { 61 {
66 get => this.Fields[(int)TextStyleTupleFields.Size].AsNumber(); 62 get => (int)this.Fields[(int)TextStyleTupleFields.Size];
67 set => this.Set((int)TextStyleTupleFields.Size, value); 63 set => this.Set((int)TextStyleTupleFields.Size, value);
68 } 64 }
69 65
70 public int Color 66 public int? Red
67 {
68 get => (int?)this.Fields[(int)TextStyleTupleFields.Red];
69 set => this.Set((int)TextStyleTupleFields.Red, value);
70 }
71
72 public int? Green
73 {
74 get => (int?)this.Fields[(int)TextStyleTupleFields.Green];
75 set => this.Set((int)TextStyleTupleFields.Green, value);
76 }
77
78 public int? Blue
71 { 79 {
72 get => (int)this.Fields[(int)TextStyleTupleFields.Color].AsNumber(); 80 get => (int?)this.Fields[(int)TextStyleTupleFields.Blue];
73 set => this.Set((int)TextStyleTupleFields.Color, value); 81 set => this.Set((int)TextStyleTupleFields.Blue, value);
74 } 82 }
75 83
76 public bool Bold 84 public bool Bold
77 { 85 {
78 get => this.Fields[(int)TextStyleTupleFields.Bold].AsBool(); 86 get => (bool)this.Fields[(int)TextStyleTupleFields.Bold];
79 set => this.Set((int)TextStyleTupleFields.Bold, value); 87 set => this.Set((int)TextStyleTupleFields.Bold, value);
80 } 88 }
81 89
82 public bool Italic 90 public bool Italic
83 { 91 {
84 get => this.Fields[(int)TextStyleTupleFields.Italic].AsBool(); 92 get => (bool)this.Fields[(int)TextStyleTupleFields.Italic];
85 set => this.Set((int)TextStyleTupleFields.Italic, value); 93 set => this.Set((int)TextStyleTupleFields.Italic, value);
86 } 94 }
87 95
88 public bool Strike 96 public bool Strike
89 { 97 {
90 get => this.Fields[(int)TextStyleTupleFields.Strike].AsBool(); 98 get => (bool)this.Fields[(int)TextStyleTupleFields.Strike];
91 set => this.Set((int)TextStyleTupleFields.Strike, value); 99 set => this.Set((int)TextStyleTupleFields.Strike, value);
92 } 100 }
93 101
94 public bool Underline 102 public bool Underline
95 { 103 {
96 get => this.Fields[(int)TextStyleTupleFields.Underline].AsBool(); 104 get => (bool)this.Fields[(int)TextStyleTupleFields.Underline];
97 set => this.Set((int)TextStyleTupleFields.Underline, value); 105 set => this.Set((int)TextStyleTupleFields.Underline, value);
98 } 106 }
99 } 107 }