Ejemplo n.º 1
0
 private static int DeviceNameComparison(
     BusDeviceDescriptor left,
     BusDeviceDescriptor right)
 {
     if (left == null && right == null)
     {
         return 0;
     }
     if (left != null && right != null)
     {
         return left.Name.CompareTo(right.Name);
     }
     return left == null ? -1 : 1;
 }
Ejemplo n.º 2
0
 public void Refresh()
 {
     PreLoadPlugins();
     var listDescriptors = new List<BusDeviceDescriptor>();
     foreach (var asm in AppDomain.CurrentDomain.GetAssemblies())
     {
         try
         {
             foreach (var type in asm.GetTypes())
             {
                 if (type.IsClass &&
                     !type.IsAbstract &&
                     typeof(BusDeviceBase).IsAssignableFrom(type))
                 {
                     try
                     {
                         BusDeviceBase device = (BusDeviceBase)Activator.CreateInstance(type);
                         var bdd = new BusDeviceDescriptor(
                             type,
                             device.Category,
                             device.Name,
                             device.Description);
                         listDescriptors.Add(bdd);
                     }
                     catch (Exception ex)
                     {
                         LogAgent.Error(ex);
                     }
                 }
             }
         }
         catch (Exception ex)
         {
             LogAgent.Error(ex);
         }
     }
     Descriptors = listDescriptors;
 }