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