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