HamBook – Blame information for rev 54

Subversion Repositories:
Rev:
Rev Author Line No. Line
15 office 1 using System;
46 office 2 using System.Reflection;
16 office 3 using System.Xml.Serialization;
15 office 4  
5 namespace HamBook.Radios.Generic
6 {
46 office 7 [XmlRoot(Namespace = "Generic")]
8 public abstract class MemoryChannel : IEquatable<MemoryChannel>
9 {
54 office 10 [XmlIgnore] public abstract string CurrentLocation { get; set; }
15 office 11  
54 office 12 [XmlIgnore] public abstract int Frequency { get; set; }
16 office 13  
54 office 14 [XmlIgnore] public abstract string Text { get; set; }
15  
16 [XmlIgnore] public abstract MemoryRadioMode MemoryRadioMode { get; set; }
17  
18 [XmlIgnore] public abstract bool Tag { get; set; }
19  
20 public abstract bool Equals(MemoryChannel other);
21  
46 office 22 public static MemoryChannel Create(string radio, params object[] param)
15 office 23 {
46 office 24 foreach (var assembly in AppDomain.CurrentDomain.GetAssemblies())
54 office 25 foreach (var type in assembly.GetTypes())
26 if (typeof(MemoryChannel).IsAssignableFrom(type))
46 office 27 {
54 office 28 var radioAttribute = type.GetCustomAttribute<RadioAttribute>();
46 office 29  
54 office 30 if (radioAttribute != null && radioAttribute.Radio == radio)
31 return (MemoryChannel)Activator.CreateInstance(type, param);
46 office 32 }
33  
34 return null;
15 office 35 }
36 }
54 office 37 }