Esempio n. 1
0
 public ServicesConfig()
 {
     MqttConfig         = new MqttConfig();
     IoTConfig          = new IoTConfig();
     DiscoveryConfig    = new DiscoveryConfig();
     ScriptEngineConfig = new ScriptEngineConfig();
     PluginsConfig      = new PluginsConfig();
 }
Esempio n. 2
0
        public App()
        {
            ServiceConfigurationSection serviceConfigSection = ServiceConfigurationSection.GetSection();

            if (serviceConfigSection == null)
            {
                throw new ConfigurationErrorsException("serviceConfigSection");
            }

            PluginsConfig serviceConfig = serviceConfigSection.Plugins;

            _importer = new Importer(serviceConfig.Folder);
            _importer.DoImport();
        }
Esempio n. 3
0
 private static string[] GetPluginFiles(string folder, PluginsConfig config)
 {
     return(config.Mode switch
     {
         PluginsMode.Automatic => Directory.GetFiles(folder, "*.dll"),
         PluginsMode.Manual => Directory.GetFiles(folder, "*.dll")
         .Where(file =>
         {
             var name = Path.GetFileNameWithoutExtension(file);
             return config.Plugins.Any(plugin =>
                                       string.Equals(plugin, name, StringComparison.InvariantCultureIgnoreCase));
         })
         .ToArray(),
         _ => throw new NotImplementedException("Config mode isn't supported.")
     });