| 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.Firewall |
| 4 | { |
| 5 | using System; |
| 6 | using WixToolset.Data; |
| 7 | |
| 8 | public enum FirewallSymbolDefinitionType |
| 9 | { |
| 10 | WixFirewallException, |
| 11 | } |
| 12 | |
| 13 | public static partial class FirewallSymbolDefinitions |
| 14 | { |
| 15 | public static IntermediateSymbolDefinition ByName(string name) |
| 16 | { |
| 17 | if (!Enum.TryParse(name, out FirewallSymbolDefinitionType type)) |
| 18 | { |
| 19 | return null; |
| 20 | } |
| 21 | |
| 22 | return ByType(type); |
| 23 | } |
| 24 | |
| 25 | public static IntermediateSymbolDefinition ByType(FirewallSymbolDefinitionType type) |
| 26 | { |
| 27 | switch (type) |
| 28 | { |
| 29 | case FirewallSymbolDefinitionType.WixFirewallException: |
| 30 | return FirewallSymbolDefinitions.WixFirewallException; |
| 31 | |
| 32 | default: |
| 33 | throw new ArgumentOutOfRangeException(nameof(type)); |
| 34 | } |
| 35 | } |
| 36 | } |
| 37 | } |