HamBook – Diff between revs 46 and 54

Subversion Repositories:
Rev:
Show entire fileIgnore whitespace
Rev 46 Rev 54
Line 1... Line -...
1 using HamBook.Properties; -  
2 using Org.BouncyCastle.Crypto.Tls; -  
3 using System; 1 using System;
4 using System.Collections.Generic; -  
5 using System.Linq; -  
6 using System.Reflection; 2 using System.Reflection;
7 using System.Text; -  
8 using System.Threading.Tasks; -  
9 using System.Xml.Serialization; 3 using System.Xml.Serialization;
Line 10... Line 4...
10   4  
11 namespace HamBook.Radios.Generic 5 namespace HamBook.Radios.Generic
12 { 6 {
Line 15... Line 9...
15 { 9 {
16 public abstract char Code { get; } 10 public abstract char Code { get; }
Line 17... Line 11...
17   11  
Line 18... Line -...
18 public abstract string Name { get; } -  
19   -  
20 public RadioMode() -  
21 { -  
22   -  
23 } 12 public abstract string Name { get; }
Line 24... Line 13...
24   13  
Line 25... Line 14...
25 public abstract string CodeToName(char code); 14 public abstract string CodeToName(char code);
26   15  
27 public abstract char NameToCode(string name); 16 public abstract char NameToCode(string name);
28   -  
29 public static RadioMode Create(string radio, params object[] param) 17  
-   18 public static RadioMode Create(string radio, params object[] param)
30 { 19 {
31 foreach (var assembly in AppDomain.CurrentDomain.GetAssemblies()) -  
32 { -  
33 foreach (var type in assembly.GetTypes()) 20 foreach (var assembly in AppDomain.CurrentDomain.GetAssemblies())
34 { 21 foreach (var type in assembly.GetTypes())
35 if (typeof(RadioMode).IsAssignableFrom(type)) 22 if (typeof(RadioMode).IsAssignableFrom(type))
36 { -  
37 var radioAttribute = type.GetCustomAttribute<RadioAttribute>(); 23 {
38   -  
39 if (radioAttribute != null && radioAttribute.Radio == radio) -  
40 { 24 var radioAttribute = type.GetCustomAttribute<RadioAttribute>();
41 return (RadioMode)Activator.CreateInstance(type, param); -  
Line 42... Line 25...
42 } 25  
43 } 26 if (radioAttribute != null && radioAttribute.Radio == radio)
44 } 27 return (RadioMode)Activator.CreateInstance(type, param);
45 } 28 }
46   29