public ServicesConfig() { MqttConfig = new MqttConfig(); IoTConfig = new IoTConfig(); DiscoveryConfig = new DiscoveryConfig(); ScriptEngineConfig = new ScriptEngineConfig(); PluginsConfig = new PluginsConfig(); }
public App() { ServiceConfigurationSection serviceConfigSection = ServiceConfigurationSection.GetSection(); if (serviceConfigSection == null) { throw new ConfigurationErrorsException("serviceConfigSection"); } PluginsConfig serviceConfig = serviceConfigSection.Plugins; _importer = new Importer(serviceConfig.Folder); _importer.DoImport(); }
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.") });