diff options
| author | Rob Mensching <rob@firegiant.com> | 2020-07-01 13:16:30 -0700 |
|---|---|---|
| committer | Rob Mensching <rob@firegiant.com> | 2020-07-01 13:17:53 -0700 |
| commit | 634fc916f620ee46c1634327e66328fabb68c9d1 (patch) | |
| tree | b5198b9541f77570518d4742a7a7e5d71f90bbac /src/WixToolset.Data/SimpleSymbolDefinitionCreator.cs | |
| parent | 43b52b254b73fc28b7eff1237629945d461f6db3 (diff) | |
| download | wix-634fc916f620ee46c1634327e66328fabb68c9d1.tar.gz wix-634fc916f620ee46c1634327e66328fabb68c9d1.tar.bz2 wix-634fc916f620ee46c1634327e66328fabb68c9d1.zip | |
Catch up a few files missed in the Great Tuple to Symbol rename
Diffstat (limited to 'src/WixToolset.Data/SimpleSymbolDefinitionCreator.cs')
| -rw-r--r-- | src/WixToolset.Data/SimpleSymbolDefinitionCreator.cs | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/src/WixToolset.Data/SimpleSymbolDefinitionCreator.cs b/src/WixToolset.Data/SimpleSymbolDefinitionCreator.cs new file mode 100644 index 00000000..e22d53e7 --- /dev/null +++ b/src/WixToolset.Data/SimpleSymbolDefinitionCreator.cs | |||
| @@ -0,0 +1,31 @@ | |||
| 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.Data | ||
| 4 | { | ||
| 5 | using System.Collections.Generic; | ||
| 6 | |||
| 7 | internal class SimpleSymbolDefinitionCreator : ISymbolDefinitionCreator | ||
| 8 | { | ||
| 9 | private Dictionary<string, IntermediateSymbolDefinition> CustomDefinitionByName { get; } = new Dictionary<string, IntermediateSymbolDefinition>(); | ||
| 10 | |||
| 11 | public void AddCustomSymbolDefinition(IntermediateSymbolDefinition definition) | ||
| 12 | { | ||
| 13 | if (!this.CustomDefinitionByName.TryGetValue(definition.Name, out var existing) || definition.Revision > existing.Revision) | ||
| 14 | { | ||
| 15 | this.CustomDefinitionByName[definition.Name] = definition; | ||
| 16 | } | ||
| 17 | } | ||
| 18 | |||
| 19 | public bool TryGetSymbolDefinitionByName(string name, out IntermediateSymbolDefinition symbolDefinition) | ||
| 20 | { | ||
| 21 | symbolDefinition = SymbolDefinitions.ByName(name); | ||
| 22 | |||
| 23 | if (symbolDefinition == null) | ||
| 24 | { | ||
| 25 | symbolDefinition = this.CustomDefinitionByName.GetValueOrDefault(name); | ||
| 26 | } | ||
| 27 | |||
| 28 | return symbolDefinition != null; | ||
| 29 | } | ||
| 30 | } | ||
| 31 | } | ||
