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