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