HamBook – Blame information for rev 56
?pathlinks?
Rev | Author | Line No. | Line |
---|---|---|---|
56 | office | 1 | using System; |
2 | using System.Collections.Generic; |
||
3 | using System.Linq; |
||
4 | using System.Reflection; |
||
5 | using System.Text; |
||
6 | using System.Threading.Tasks; |
||
7 | |||
8 | namespace HamBook.Radios.Generic |
||
9 | { |
||
10 | public abstract class RadioMenu |
||
11 | { |
||
12 | public abstract int[] Indices { get; } |
||
13 | |||
14 | public abstract int MenuToCAT(int menu, string value); |
||
15 | |||
16 | public static RadioMenu Create(string radio) |
||
17 | { |
||
18 | foreach (var assembly in AppDomain.CurrentDomain.GetAssemblies()) |
||
19 | { |
||
20 | foreach (var type in assembly.GetTypes()) |
||
21 | { |
||
22 | if (typeof(RadioMenu).IsAssignableFrom(type)) |
||
23 | { |
||
24 | var radioAttribute = type.GetCustomAttribute<RadioAttribute>(); |
||
25 | |||
26 | if (radioAttribute != null && radioAttribute.Radio == radio) |
||
27 | return (RadioMenu)Activator.CreateInstance(type); |
||
28 | } |
||
29 | } |
||
30 | } |
||
31 | |||
32 | return null; |
||
33 | } |
||
34 | } |
||
35 | } |