aboutsummaryrefslogtreecommitdiff
path: root/src/test/Example.Extension/ExampleWindowsInstallerBackendExtension.cs
blob: 4ee682d3947573c48cfb25342b0360afee5bd398 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
// 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.

namespace Example.Extension
{
    using System.Collections.Generic;
    using WixToolset.Data;
    using WixToolset.Data.WindowsInstaller;
    using WixToolset.Extensibility;

    internal class ExampleWindowsInstallerBackendExtension : BaseWindowsInstallerBackendBinderExtension
    {
        public override IEnumerable<TableDefinition> TableDefinitions => ExampleTableDefinitions.All;

        public override bool TryAddTupleToOutput(IntermediateSection section, IntermediateTuple tuple, WindowsInstallerData output, TableDefinitionCollection tableDefinitions)
        {
#if ALTERNATIVE_TO_USING_HELPER
            switch (tuple.Definition.Name)
            {
                case ExampleTupleDefinitions.ExampleName:
                    {
                        var row = this.BackendHelper.CreateRow(section, tuple, output, ExampleTableDefinitions.ExampleTable);
                        row[0] = tuple[0].AsString();
                        row[1] = tuple[1].AsString();
                    }
                    return true;
            }

            return false;
#else
            return this.BackendHelper.TryAddTupleToOutputMatchingTableDefinitions(section, tuple, output, tableDefinitions);
#endif
        }
    }
}