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