HamBook – Diff between revs 46 and 54

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