Esempio n. 1
0
        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();
        }
Esempio n. 2
0
        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();
        }