diff options
| author | Rob Mensching <rob@firegiant.com> | 2020-06-23 16:45:26 -0700 |
|---|---|---|
| committer | Rob Mensching <rob@firegiant.com> | 2020-06-23 16:52:05 -0700 |
| commit | 0185c2ea6e638dc7e1c5224739717ba2152bb510 (patch) | |
| tree | 4b5241794849f4b07b9d2eb73a2a761a230a1242 /src/WixToolset.Core | |
| parent | 51441387b09aa6b8c00fbc0d8841118b7fee63d6 (diff) | |
| download | wix-0185c2ea6e638dc7e1c5224739717ba2152bb510.tar.gz wix-0185c2ea6e638dc7e1c5224739717ba2152bb510.tar.bz2 wix-0185c2ea6e638dc7e1c5224739717ba2152bb510.zip | |
Move Windows Installer specific backend services to WindowsInstaller
Diffstat (limited to 'src/WixToolset.Core')
| -rw-r--r-- | src/WixToolset.Core/ExtensibilityServices/WindowsInstallerBackendHelper.cs | 61 | ||||
| -rw-r--r-- | src/WixToolset.Core/WixToolsetServiceProvider.cs | 1 |
2 files changed, 0 insertions, 62 deletions
diff --git a/src/WixToolset.Core/ExtensibilityServices/WindowsInstallerBackendHelper.cs b/src/WixToolset.Core/ExtensibilityServices/WindowsInstallerBackendHelper.cs deleted file mode 100644 index a923a8cc..00000000 --- a/src/WixToolset.Core/ExtensibilityServices/WindowsInstallerBackendHelper.cs +++ /dev/null | |||
| @@ -1,61 +0,0 @@ | |||
| 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.Core.ExtensibilityServices | ||
| 4 | { | ||
| 5 | using System.Linq; | ||
| 6 | using WixToolset.Data; | ||
| 7 | using WixToolset.Data.WindowsInstaller; | ||
| 8 | using WixToolset.Extensibility.Services; | ||
| 9 | |||
| 10 | internal class WindowsInstallerBackendHelper : IWindowsInstallerBackendHelper | ||
| 11 | { | ||
| 12 | public Row CreateRow(IntermediateSection section, IntermediateTuple tuple, WindowsInstallerData output, TableDefinition tableDefinition) | ||
| 13 | { | ||
| 14 | var table = output.EnsureTable(tableDefinition); | ||
| 15 | |||
| 16 | var row = table.CreateRow(tuple.SourceLineNumbers); | ||
| 17 | row.SectionId = section.Id; | ||
| 18 | |||
| 19 | return row; | ||
| 20 | } | ||
| 21 | |||
| 22 | public bool TryAddTupleToOutputMatchingTableDefinitions(IntermediateSection section, IntermediateTuple tuple, WindowsInstallerData output, TableDefinitionCollection tableDefinitions) | ||
| 23 | { | ||
| 24 | var tableDefinition = tableDefinitions.FirstOrDefault(t => t.TupleDefinition?.Name == tuple.Definition.Name); | ||
| 25 | if (tableDefinition == null) | ||
| 26 | { | ||
| 27 | return false; | ||
| 28 | } | ||
| 29 | |||
| 30 | var row = this.CreateRow(section, tuple, output, tableDefinition); | ||
| 31 | var rowOffset = 0; | ||
| 32 | |||
| 33 | if (tableDefinition.TupleIdIsPrimaryKey) | ||
| 34 | { | ||
| 35 | row[0] = tuple.Id.Id; | ||
| 36 | rowOffset = 1; | ||
| 37 | } | ||
| 38 | |||
| 39 | for (var i = 0; i < tuple.Fields.Length; ++i) | ||
| 40 | { | ||
| 41 | if (i < tableDefinition.Columns.Length) | ||
| 42 | { | ||
| 43 | var column = tableDefinition.Columns[i + rowOffset]; | ||
| 44 | |||
| 45 | switch (column.Type) | ||
| 46 | { | ||
| 47 | case ColumnType.Number: | ||
| 48 | row[i + rowOffset] = column.Nullable ? tuple.AsNullableNumber(i) : tuple.AsNumber(i); | ||
| 49 | break; | ||
| 50 | |||
| 51 | default: | ||
| 52 | row[i + rowOffset] = tuple.AsString(i); | ||
| 53 | break; | ||
| 54 | } | ||
| 55 | } | ||
| 56 | } | ||
| 57 | |||
| 58 | return true; | ||
| 59 | } | ||
| 60 | } | ||
| 61 | } | ||
diff --git a/src/WixToolset.Core/WixToolsetServiceProvider.cs b/src/WixToolset.Core/WixToolsetServiceProvider.cs index 1d475d00..d7a6171a 100644 --- a/src/WixToolset.Core/WixToolsetServiceProvider.cs +++ b/src/WixToolset.Core/WixToolsetServiceProvider.cs | |||
| @@ -25,7 +25,6 @@ namespace WixToolset.Core | |||
| 25 | this.AddService((provider, singletons) => AddSingleton<IPreprocessHelper>(singletons, new PreprocessHelper(provider))); | 25 | this.AddService((provider, singletons) => AddSingleton<IPreprocessHelper>(singletons, new PreprocessHelper(provider))); |
| 26 | this.AddService((provider, singletons) => AddSingleton<IBackendHelper>(singletons, new BackendHelper(provider))); | 26 | this.AddService((provider, singletons) => AddSingleton<IBackendHelper>(singletons, new BackendHelper(provider))); |
| 27 | this.AddService((provider, singletons) => AddSingleton<IPathResolver>(singletons, new PathResolver())); | 27 | this.AddService((provider, singletons) => AddSingleton<IPathResolver>(singletons, new PathResolver())); |
| 28 | this.AddService((provider, singletons) => AddSingleton<IWindowsInstallerBackendHelper>(singletons, new WindowsInstallerBackendHelper())); | ||
| 29 | 28 | ||
| 30 | // Transients. | 29 | // Transients. |
| 31 | this.AddService<ICommandLineArguments>((provider, singletons) => new CommandLineArguments(provider)); | 30 | this.AddService<ICommandLineArguments>((provider, singletons) => new CommandLineArguments(provider)); |
