Пример #1
0
        public List <Plugin> CreatePluginsFromIPlugins(IEnumerable <IPlugin> iPluginsList, string assemblyLocation)
        {
            var pluginList  = new List <Plugin>();
            var pluginsList = iPluginsList.ToList();

            if (pluginsList.IsNullOrEmpty())
            {
                return(pluginList);
            }

            pluginList.AddRange(from iPlugin in pluginsList
                                let interfaces = iPlugin.GetType().GetInterfaces()
                                                 let httpSupport = interfaces.Any(x => x.Name.Contains("HttpSupport"))
                                                                   let mqttSupport = interfaces.Any(x => x.Name.Contains("MqttSupport"))
                                                                                     select new Plugin(iPlugin.Name, string.Empty, PluginUtils.GetEnumType(iPlugin.Name), assemblyLocation,
                                                                                                       true, iPlugin.AssemblyVersion, iPlugin.Company, mqttSupport, httpSupport));
            return(pluginList);
        }