diff options
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 | } | ||
