diff options
| author | Rob Mensching <rob@firegiant.com> | 2017-11-01 10:56:09 -0700 |
|---|---|---|
| committer | Rob Mensching <rob@firegiant.com> | 2017-11-01 10:56:09 -0700 |
| commit | 69b15d96cebdbb7201b1849b4f62786633d70b8d (patch) | |
| tree | 4b65de8679e4b4ab81b69edcccbac1ae9f55a16d /src/WixToolset.Data/IntermediateTupleExtensions.cs | |
| parent | a8656a87887d6cb2c54f4bbeacee37f7074f1032 (diff) | |
| download | wix-69b15d96cebdbb7201b1849b4f62786633d70b8d.tar.gz wix-69b15d96cebdbb7201b1849b4f62786633d70b8d.tar.bz2 wix-69b15d96cebdbb7201b1849b4f62786633d70b8d.zip | |
Introduce WiX Intermediate Representation
Diffstat (limited to 'src/WixToolset.Data/IntermediateTupleExtensions.cs')
| -rw-r--r-- | src/WixToolset.Data/IntermediateTupleExtensions.cs | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/src/WixToolset.Data/IntermediateTupleExtensions.cs b/src/WixToolset.Data/IntermediateTupleExtensions.cs new file mode 100644 index 00000000..9865c06a --- /dev/null +++ b/src/WixToolset.Data/IntermediateTupleExtensions.cs | |||
| @@ -0,0 +1,41 @@ | |||
| 1 | // Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information. | ||
| 2 | |||
| 3 | namespace WixToolset.Data | ||
| 4 | { | ||
| 5 | public static class IntermediateTupleExtensions | ||
| 6 | { | ||
| 7 | public static IntermediateField Set(this IntermediateTuple tuple, int index, object value) | ||
| 8 | { | ||
| 9 | var definition = tuple.Definition.FieldDefinitions[index]; | ||
| 10 | |||
| 11 | var field = tuple.Fields[index].Set(definition, value); ; | ||
| 12 | |||
| 13 | return tuple.Fields[index] = field; | ||
| 14 | } | ||
| 15 | |||
| 16 | public static bool AsBool(this IntermediateTuple tuple, int index) | ||
| 17 | { | ||
| 18 | return tuple?.Fields[index].AsBool() ?? false; | ||
| 19 | } | ||
| 20 | |||
| 21 | public static bool? AsNullableBool(this IntermediateTuple tuple, int index) | ||
| 22 | { | ||
| 23 | return tuple?.Fields[index].AsNullableBool(); | ||
| 24 | } | ||
| 25 | |||
| 26 | public static int AsNumber(this IntermediateTuple tuple, int index) | ||
| 27 | { | ||
| 28 | return tuple?.Fields[index].AsNumber() ?? 0; | ||
| 29 | } | ||
| 30 | |||
| 31 | public static int? AsNullableNumber(this IntermediateTuple tuple, int index) | ||
| 32 | { | ||
| 33 | return tuple?.Fields[index].AsNullableNumber(); | ||
| 34 | } | ||
| 35 | |||
| 36 | public static string AsString(this IntermediateTuple tuple, int index) | ||
| 37 | { | ||
| 38 | return tuple?.Fields[index].AsString(); | ||
| 39 | } | ||
| 40 | } | ||
| 41 | } | ||
