HamBook – Diff between revs 46 and 54
?pathlinks?
Rev 46 | Rev 54 | |||
---|---|---|---|---|
Line 1... | Line -... | |||
1 | using Org.BouncyCastle.Crypto.Tls; |
- | ||
2 | using System; |
1 | using System; |
|
3 | using System.Collections.Generic; |
- | ||
4 | using System.Linq; |
- | ||
5 | using System.Reflection; |
2 | using System.Reflection; |
|
6 | using System.Text; |
- | ||
7 | using System.Threading.Tasks; |
- | ||
8 | using System.Xml.Serialization; |
3 | using System.Xml.Serialization; |
|
Line 9... | Line 4... | |||
9 | |
4 | |
|
10 | namespace HamBook.Radios.Generic |
5 | namespace HamBook.Radios.Generic |
|
11 | { |
6 | { |
|
12 | [XmlRoot(Namespace = "Generic")] |
7 | [XmlRoot(Namespace = "Generic")] |
|
13 | [XmlInclude(typeof(Radios.Yaesu.FT_891.MemoryRadioMode))] |
8 | [XmlInclude(typeof(Yaesu.FT_891.MemoryRadioMode))] |
|
14 | public abstract class MemoryRadioMode |
9 | public abstract class MemoryRadioMode |
|
15 | { |
- | ||
16 | [XmlIgnore] |
10 | { |
|
Line 17... | Line -... | |||
17 | public abstract char Code { get; set; } |
- | ||
18 | |
11 | [XmlIgnore] public abstract char Code { get; set; } |
|
19 | [XmlIgnore] |
- | ||
20 | public abstract string Name { get; set; } |
- | ||
21 | |
- | ||
22 | public MemoryRadioMode() |
- | ||
23 | { |
- | ||
Line 24... | Line 12... | |||
24 | |
12 | |
|
Line 25... | Line 13... | |||
25 | } |
13 | [XmlIgnore] public abstract string Name { get; set; } |
|
Line 26... | Line 14... | |||
26 | |
14 | |
|
27 | public abstract string CodeToName(char code); |
15 | public abstract string CodeToName(char code); |
|
28 | |
16 | |
|
29 | public abstract char NameToCode(string name); |
- | ||
30 | |
17 | public abstract char NameToCode(string name); |
|
- | 18 | |
||
31 | public static MemoryRadioMode Create(string radio, params object[] param) |
19 | public static MemoryRadioMode Create(string radio, params object[] param) |
|
32 | { |
- | ||
33 | foreach (var assembly in AppDomain.CurrentDomain.GetAssemblies()) |
- | ||
34 | { |
20 | { |
|
35 | foreach (var type in assembly.GetTypes()) |
21 | foreach (var assembly in AppDomain.CurrentDomain.GetAssemblies()) |
|
36 | { |
22 | foreach (var type in assembly.GetTypes()) |
|
37 | if (typeof(MemoryRadioMode).IsAssignableFrom(type)) |
- | ||
38 | { |
23 | if (typeof(MemoryRadioMode).IsAssignableFrom(type)) |
|
39 | var radioAttribute = type.GetCustomAttribute<RadioAttribute>(); |
- | ||
40 | |
- | ||
41 | if (radioAttribute != null && radioAttribute.Radio == radio) |
24 | { |
|
42 | { |
- | ||
Line 43... | Line 25... | |||
43 | return (MemoryRadioMode)Activator.CreateInstance(type, param); |
25 | var radioAttribute = type.GetCustomAttribute<RadioAttribute>(); |
|
44 | } |
26 | |
|
45 | } |
27 | if (radioAttribute != null && radioAttribute.Radio == radio) |
|
46 | } |
28 | return (MemoryRadioMode)Activator.CreateInstance(type, param); |
|
47 | } |
29 | } |