示例#1
0
        public Plugin Get(string pluginId)
        {
            Logger.LogDebug(this, "[CLASS].Get('{0}')", pluginId);

            try
            {
                XmlSettingsItem pluginSection = this.Settings.GetItem(PluginManager.SETTINGS_KEY_PLUGINS);
                if (pluginSection != null)
                {
                    XmlSettingsItem xmlPlugin = pluginSection.GetItem(pluginId);
                    Plugin          plugin    = new Plugin();
                    plugin.ID   = xmlPlugin.Key;
                    plugin.Name = xmlPlugin.Value;
                    plugin.File = xmlPlugin.GetString("assembly-file");

                    return(plugin);
                }

                return(null);
            }
            catch (Exception ex)
            {
                Logger.LogError(this, ex);

                throw;
            }
        }
示例#2
0
        /// <summary>
        /// Initialize the instance data.
        /// </summary>
        private void Initialize()
        {
            XmlSettingsItem systems = OTCContext.Settings.GetItem(SystemManager.SETTINGS_SYSTEMS_KEY, true);

            this.SystemSettingsNode = systems.GetItem(this.ID, true);
            this.Status             = SystemStatus.Disconnected;
        }
示例#3
0
        public List <Plugin> GetAll()
        {
            List <Plugin> plugins = new List <Plugin>();

            Logger.LogDebug(this, "[CLASS].GetAll()");

            try
            {
                XmlSettingsItem pluginSection = this.Settings.GetItem(PluginManager.SETTINGS_KEY_PLUGINS);
                if (pluginSection != null)
                {
                    foreach (XmlSettingsItem item in pluginSection.Items.Values)
                    {
                        XmlSettingsItem xmlPlugin = pluginSection.GetItem(item.Key);
                        Plugin          plugin    = new Plugin();
                        plugin.ID   = xmlPlugin.Key;
                        plugin.Name = xmlPlugin.Value;
                        plugin.File = xmlPlugin.GetString("assembly-file");

                        plugins.Add(plugin);
                    }

                    return(plugins);
                }

                return(null);
            }
            catch (Exception ex)
            {
                Logger.LogError(this, ex);

                throw;
            }
        }