Esempio n. 1
0
 public static IDetectorPlugin AddDetector(IOpenRPAClient client, entity.Detector entity)
 {
     foreach (var d in detectorPluginTypes)
     {
         if (d.Key == entity.Plugin)
         {
             try
             {
                 IDetectorPlugin plugin = (IDetectorPlugin)Activator.CreateInstance(d.Value);
                 if (string.IsNullOrEmpty(entity.name))
                 {
                     entity.name = plugin.Name;
                 }
                 plugin.Initialize(client, entity);
                 IDetectorPlugin exists = Plugins.detectorPlugins.Where(x => x.Entity._id == entity._id).FirstOrDefault();
                 if (exists == null)
                 {
                     Plugins.detectorPlugins.Add(plugin);
                 }
                 return(plugin);
             }
             catch (Exception ex)
             {
                 Log.Error("OpenRPA.Interfaces.Plugins.AddDetector: " + ex.ToString());
             }
         }
     }
     return(null);
 }
Esempio n. 2
0
 public static IDetectorPlugin AddDetector(entity.Detector entity)
 {
     foreach (var d in detectorPluginTypes)
     {
         if (d.Key == entity.Plugin)
         {
             try
             {
                 IDetectorPlugin plugin = (IDetectorPlugin)Activator.CreateInstance(d.Value);
                 if (string.IsNullOrEmpty(entity.name))
                 {
                     entity.name = plugin.Name;
                 }
                 plugin.Initialize(entity);
                 Plugins.detectorPlugins.Add(plugin);
                 return(plugin);
             }
             catch (Exception ex)
             {
                 Log.Error("OpenRPA.Interfaces.Plugins.AddDetector: " + ex.ToString());
             }
         }
     }
     return(null);
 }