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