diff options
| author | Rob Mensching <rob@firegiant.com> | 2019-10-07 11:18:13 -0700 |
|---|---|---|
| committer | Rob Mensching <rob@firegiant.com> | 2019-10-07 11:59:14 -0700 |
| commit | 860676fa5b40a1904478151e9b4934c004e7db63 (patch) | |
| tree | 83fabd53f2a68dcf56bc8da66d88e115af3764b0 /src/WixToolset.Core/ExtensibilityServices/WindowsInstallerBackendHelper.cs | |
| parent | 3b98dac62b47d590f3465985362d6e6fd100b1c0 (diff) | |
| download | wix-860676fa5b40a1904478151e9b4934c004e7db63.tar.gz wix-860676fa5b40a1904478151e9b4934c004e7db63.tar.bz2 wix-860676fa5b40a1904478151e9b4934c004e7db63.zip | |
Implement Bundle build
Diffstat (limited to 'src/WixToolset.Core/ExtensibilityServices/WindowsInstallerBackendHelper.cs')
| -rw-r--r-- | src/WixToolset.Core/ExtensibilityServices/WindowsInstallerBackendHelper.cs | 32 |
1 files changed, 17 insertions, 15 deletions
diff --git a/src/WixToolset.Core/ExtensibilityServices/WindowsInstallerBackendHelper.cs b/src/WixToolset.Core/ExtensibilityServices/WindowsInstallerBackendHelper.cs index 6e0ffce6..26982ad6 100644 --- a/src/WixToolset.Core/ExtensibilityServices/WindowsInstallerBackendHelper.cs +++ b/src/WixToolset.Core/ExtensibilityServices/WindowsInstallerBackendHelper.cs | |||
| @@ -1,8 +1,7 @@ | |||
| 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. | 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 | 2 | ||
| 3 | namespace WixToolset.Core.ExtensibilityServices | 3 | namespace WixToolset.Core.ExtensibilityServices |
| 4 | { | 4 | { |
| 5 | using System; | ||
| 6 | using System.Linq; | 5 | using System.Linq; |
| 7 | using WixToolset.Data; | 6 | using WixToolset.Data; |
| 8 | using WixToolset.Data.WindowsInstaller; | 7 | using WixToolset.Data.WindowsInstaller; |
| @@ -10,14 +9,9 @@ namespace WixToolset.Core.ExtensibilityServices | |||
| 10 | 9 | ||
| 11 | internal class WindowsInstallerBackendHelper : IWindowsInstallerBackendHelper | 10 | internal class WindowsInstallerBackendHelper : IWindowsInstallerBackendHelper |
| 12 | { | 11 | { |
| 13 | public WindowsInstallerBackendHelper(IServiceProvider serviceProvider) | 12 | public bool TryAddTupleToOutputMatchingTableDefinitions(IntermediateTuple tuple, Output output, TableDefinition[] tableDefinitions) => this.TryAddTupleToOutputMatchingTableDefinitions(tuple, output, tableDefinitions, false); |
| 14 | { | ||
| 15 | this.ServiceProvider = serviceProvider; | ||
| 16 | } | ||
| 17 | 13 | ||
| 18 | private IServiceProvider ServiceProvider { get; } | 14 | public bool TryAddTupleToOutputMatchingTableDefinitions(IntermediateTuple tuple, Output output, TableDefinition[] tableDefinitions, bool columnZeroIsId) |
| 19 | |||
| 20 | public bool TryAddTupleToOutputMatchingTableDefinitions(IntermediateTuple tuple, Output output, TableDefinition[] tableDefinitions) | ||
| 21 | { | 15 | { |
| 22 | var tableDefinition = tableDefinitions.FirstOrDefault(t => t.Name == tuple.Definition.Name); | 16 | var tableDefinition = tableDefinitions.FirstOrDefault(t => t.Name == tuple.Definition.Name); |
| 23 | 17 | ||
| @@ -28,6 +22,14 @@ namespace WixToolset.Core.ExtensibilityServices | |||
| 28 | 22 | ||
| 29 | var table = output.EnsureTable(tableDefinition); | 23 | var table = output.EnsureTable(tableDefinition); |
| 30 | var row = table.CreateRow(tuple.SourceLineNumbers); | 24 | var row = table.CreateRow(tuple.SourceLineNumbers); |
| 25 | var rowOffset = 0; | ||
| 26 | |||
| 27 | if (columnZeroIsId) | ||
| 28 | { | ||
| 29 | row[0] = tuple.Id.Id; | ||
| 30 | rowOffset = 1; | ||
| 31 | } | ||
| 32 | |||
| 31 | for (var i = 0; i < tuple.Fields.Length; ++i) | 33 | for (var i = 0; i < tuple.Fields.Length; ++i) |
| 32 | { | 34 | { |
| 33 | if (i < tableDefinition.Columns.Length) | 35 | if (i < tableDefinition.Columns.Length) |
| @@ -36,13 +38,13 @@ namespace WixToolset.Core.ExtensibilityServices | |||
| 36 | 38 | ||
| 37 | switch (column.Type) | 39 | switch (column.Type) |
| 38 | { | 40 | { |
| 39 | case ColumnType.Number: | 41 | case ColumnType.Number: |
| 40 | row[i] = tuple.AsNumber(i); | 42 | row[i + rowOffset] = column.Nullable ? tuple.AsNullableNumber(i) : tuple.AsNumber(i); |
| 41 | break; | 43 | break; |
| 42 | 44 | ||
| 43 | default: | 45 | default: |
| 44 | row[i] = tuple.AsString(i); | 46 | row[i + rowOffset] = tuple.AsString(i); |
| 45 | break; | 47 | break; |
| 46 | } | 48 | } |
| 47 | } | 49 | } |
| 48 | } | 50 | } |
