diff options
| author | Sean Hall <r.sean.hall@gmail.com> | 2021-06-29 19:14:02 -0500 |
|---|---|---|
| committer | Sean Hall <r.sean.hall@gmail.com> | 2021-07-02 12:50:09 -0500 |
| commit | 8cbfc326cccf8d9b3b63cb6f752fc770f7dee0fc (patch) | |
| tree | 639f70e7327cdfade62271da04aaaaae2e85cc05 /src/api/burn/WixToolset.Mba.Core/MbaCommand.cs | |
| parent | e844f12f7d7247a1e9ba4eef2a388e614001bb24 (diff) | |
| download | wix-8cbfc326cccf8d9b3b63cb6f752fc770f7dee0fc.tar.gz wix-8cbfc326cccf8d9b3b63cb6f752fc770f7dee0fc.tar.bz2 wix-8cbfc326cccf8d9b3b63cb6f752fc770f7dee0fc.zip | |
Expose overridable variable APIs in balutil and Mba.Core.
Fixes #4777
Diffstat (limited to 'src/api/burn/WixToolset.Mba.Core/MbaCommand.cs')
| -rw-r--r-- | src/api/burn/WixToolset.Mba.Core/MbaCommand.cs | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/src/api/burn/WixToolset.Mba.Core/MbaCommand.cs b/src/api/burn/WixToolset.Mba.Core/MbaCommand.cs new file mode 100644 index 00000000..e7e49607 --- /dev/null +++ b/src/api/burn/WixToolset.Mba.Core/MbaCommand.cs | |||
| @@ -0,0 +1,33 @@ | |||
| 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.Mba.Core | ||
| 4 | { | ||
| 5 | using System.Collections.Generic; | ||
| 6 | |||
| 7 | /// <summary> | ||
| 8 | /// Default implementation of <see cref="IMbaCommand"/>. | ||
| 9 | /// </summary> | ||
| 10 | internal sealed class MbaCommand : IMbaCommand | ||
| 11 | { | ||
| 12 | public string[] UnknownCommandLineArgs { get; internal set; } | ||
| 13 | |||
| 14 | public KeyValuePair<string, string>[] Variables { get; internal set; } | ||
| 15 | |||
| 16 | internal MbaCommand() { } | ||
| 17 | |||
| 18 | public void SetOverridableVariables(IOverridableVariables overridableVariables, IEngine engine) | ||
| 19 | { | ||
| 20 | foreach (var kvp in this.Variables) | ||
| 21 | { | ||
| 22 | if (!overridableVariables.Variables.TryGetValue(kvp.Key, out var overridableVariable)) | ||
| 23 | { | ||
| 24 | engine.Log(LogLevel.Error, string.Format("Ignoring attempt to set non-overridable variable: '{0}'.", kvp.Key)); | ||
| 25 | } | ||
| 26 | else | ||
| 27 | { | ||
| 28 | engine.SetVariableString(overridableVariable.Name, kvp.Value, false); | ||
| 29 | } | ||
| 30 | } | ||
| 31 | } | ||
| 32 | } | ||
| 33 | } | ||
