HamBook – Blame information for rev
?pathlinks?
Rev | Author | Line No. | Line |
---|---|---|---|
54 | office | 1 | using System; |
2 | using System.Reflection; |
||
3 | |||
4 | namespace HamBook.Radios.Generic |
||
5 | { |
||
6 | public abstract class MenuIndex |
||
7 | { |
||
8 | public abstract int[] Indices { get; } |
||
9 | |||
10 | public static MenuIndex Create(string radio) |
||
11 | { |
||
12 | foreach (var assembly in AppDomain.CurrentDomain.GetAssemblies()) |
||
13 | foreach (var type in assembly.GetTypes()) |
||
14 | if (typeof(MenuIndex).IsAssignableFrom(type)) |
||
15 | { |
||
16 | var radioAttribute = type.GetCustomAttribute<RadioAttribute>(); |
||
17 | |||
18 | if (radioAttribute != null && radioAttribute.Radio == radio) |
||
19 | return (MenuIndex)Activator.CreateInstance(type); |
||
20 | } |
||
21 | |||
22 | return null; |
||
23 | } |
||
24 | } |
||
25 | } |