HamBook – Diff between revs 43 and 54

Subversion Repositories:
Rev:
Show entire fileIgnore whitespace
Rev 43 Rev 54
Line 1... Line -...
1 using HamBook.Properties; -  
2 using System; 1 using System;
3 using System.Collections.Generic; 2 using System.Collections.Generic;
4 using System.Linq; -  
5 using System.Reflection; 3 using System.Reflection;
6 using System.Text; -  
7 using System.Threading.Tasks; -  
Line 8... Line 4...
8   4  
9 namespace HamBook.Radios.Generic 5 namespace HamBook.Radios.Generic
10 { 6 {
11 public abstract class MemoryBanks 7 public abstract class MemoryBanks
12 { 8 {
Line 13... Line 9...
13 public abstract IEnumerable<string> GetMemoryBanks(); 9 public abstract IEnumerable<string> GetMemoryBanks();
14   10  
15 public static MemoryBanks Create(string radio) 11 public static MemoryBanks Create(string radio)
16 { -  
17 foreach (var assembly in AppDomain.CurrentDomain.GetAssemblies()) 12 {
-   13 foreach (var assembly in AppDomain.CurrentDomain.GetAssemblies())
18 { 14 foreach (var type in assembly.GetTypes())
19 foreach (var type in assembly.GetTypes()) -  
20 { -  
21 if (typeof(MemoryBanks).IsAssignableFrom(type)) 15 if (typeof(MemoryBanks).IsAssignableFrom(type))
Line 22... Line 16...
22 { 16 {
23 var radioAttribute = type.GetCustomAttribute<RadioAttribute>(); -  
24   17 var radioAttribute = type.GetCustomAttribute<RadioAttribute>();
25 if (radioAttribute != null && radioAttribute.Radio == radio) -  
26 { -  
27 return (MemoryBanks)Activator.CreateInstance(type); 18  
28 } -  
Line 29... Line 19...
29 } 19 if (radioAttribute != null && radioAttribute.Radio == radio)
30 } 20 return (MemoryBanks)Activator.CreateInstance(type);
31 } 21 }
32   22  
33 return null; 23 return null;