HamBook – Blame information for rev 44

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