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