private void StartPlugins() { TvBusinessLayer layer = new TvBusinessLayer(); Log.Info("TV Service: Load plugins"); _plugins = new PluginLoader(); _plugins.Load(); Log.Info("TV Service: Plugins loaded"); // start plugins foreach (ITvServerPlugin plugin in _plugins.Plugins) { if (plugin.MasterOnly == false || _controller.IsMaster) { Setting setting = layer.GetSetting(String.Format("plugin{0}", plugin.Name), "false"); // Start PowerScheduler if PS++ is enabled and remove PS++ entry if (plugin.Name == "PowerScheduler") { Setting settingPSpp = layer.GetSetting(String.Format("pluginPowerScheduler++"), "false"); if (settingPSpp.Value == "true") { setting.Value = "true"; setting.Persist(); } settingPSpp.Remove(); } if (setting.Value == "true") { Log.Info("TV Service: Plugin: {0} started", plugin.Name); try { plugin.Start(_controller); _pluginsStarted.Add(plugin); } catch (Exception ex) { Log.Info("TV Service: Plugin: {0} failed to start", plugin.Name); Log.Write(ex); } } else { Log.Info("TV Service: Plugin: {0} disabled", plugin.Name); } } } Log.Info("TV Service: Plugins started"); // fire off startedAll on plugins foreach (ITvServerPlugin plugin in _pluginsStarted) { if (plugin is ITvServerPluginStartedAll) { Log.Info("TV Service: Plugin: {0} started all", plugin.Name); try { (plugin as ITvServerPluginStartedAll).StartedAll(); } catch (Exception ex) { Log.Info("TV Service: Plugin: {0} failed to startedAll", plugin.Name); Log.Write(ex); } } } }