HamBook – Blame information for rev 44

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