Beispiel #1
0
        /// <inheritdoc />
        public ControlPanelTab CreateControlPanelTab()
        {
            var tab = new PluginControlPanelTab();

            foreach (IPluginDescriptor pluginDescriptor in registry.Plugins)
            {
                PluginTraits traits = pluginDescriptor.ResolveTraits();

                tab.AddPlugin(pluginDescriptor.PluginId, traits.Name, traits.Version,
                              traits.Icon, traits.Description,
                              pluginDescriptor.IsDisabled ? pluginDescriptor.DisabledReason : null);
            }

            return(tab);
        }
Beispiel #2
0
        private void UpdatePluginTraits()
        {
            var settings = PluginSettings.Default;

            if (settings.Enabled & settings.Plugins.Count > 0)
            {
                var pluginSettings = settings.Plugins[0];

                if (log.IsInfoEnabled)
                {
                    log.InfoFormat("Plugin configured: name={0}", pluginSettings.Name);

                    if (pluginSettings.CustomAttributes.Count > 0)
                    {
                        foreach (var att in pluginSettings.CustomAttributes)
                        {
                            log.InfoFormat("\tAttribute: {0}={1}", att.Key, att.Value);
                        }
                    }
                }

                var pluginInfo = new PluginInfo
                {
                    Name         = pluginSettings.Name,
                    Version      = pluginSettings.Version,
                    AssemblyName = pluginSettings.AssemblyName,
                    Type         = pluginSettings.Type,
                    ConfigParams = pluginSettings.CustomAttributes
                };

                this.PluginTraits = PluginTraits.Create(pluginInfo);
                return;
            }

            this.PluginTraits = PluginTraits.Create(new PluginInfo());
        }