internal void Run(FileConfiguration cfg) { today = DateTime.Parse(cfg.getString("env.date")); plugins.LoadAll(this, cfg.SubSet("plugin")); foreach (IPlugin plugin in plugins) if (plugin is IEnvironmentListener) ((IEnvironmentListener)plugin).EnvironmentOpening(); IsRunning = true; try { scheduler.Run(); } catch (Exception ex) { Logger.Log(Now, LogLevel.ERROR, "Main thread exception", ex: ex); } IsRunning = false; foreach (IPlugin plugin in plugins) if (plugin is IEnvironmentListener) ((IEnvironmentListener)plugin).EnvironmentClosing(); }
public void Run(FileConfiguration cfg, Action entryPoint) { plugins.LoadAll(this, cfg.SubSet("plugin")); foreach (IPlugin plugin in plugins) if (plugin is IEnvironmentListener) ((IEnvironmentListener)plugin).EnvironmentOpening(); entryPoint(); foreach (IPlugin plugin in plugins) if (plugin is IEnvironmentListener) ((IEnvironmentListener)plugin).EnvironmentClosing(); }