Exemplo n.º 1
0
        //---------------------------------------------------------------------

        private PlugIn[] LoadAndInitPlugIns(PlugInAndInitFile[] plugIns)
        {
            PlugIn[] loadedPlugIns = new PlugIn[plugIns.Length];
            foreach (int i in Indexes.Of(plugIns))
            {
                PlugInAndInitFile plugInAndInitFile = plugIns[i];
                UI.WriteLine("Loading {0} plug-in ...", plugInAndInitFile.Info.Name);
                PlugIn loadedPlugIn = Loader.Load <PlugIn>(plugInAndInitFile.Info);
                loadedPlugIn.Initialize(plugInAndInitFile.InitFile, this);
                loadedPlugIns[i] = loadedPlugIn;
                if (loadedPlugIn is PlugIns.I2PhaseInitialization)
                {
                    plugInsWith2PhaseInit.Add((PlugIns.I2PhaseInitialization)loadedPlugIn);
                }
                if (loadedPlugIn is PlugIns.ICleanUp)
                {
                    plugInsWithCleanUp.Add((PlugIns.ICleanUp)loadedPlugIn);
                }
            }
            return(loadedPlugIns);
        }
Exemplo n.º 2
0
        //---------------------------------------------------------------------

        private void Run(PlugIn plugIn)
        {
            UI.WriteLine("Running {0} ...", plugIn.Name);
            plugIn.Run();
        }
Exemplo n.º 3
0
        //---------------------------------------------------------------------

        private bool IsPlugInTimestep(PlugIn plugIn)
        {
            return((plugIn.Timestep > 0) && (timeSinceStart % plugIn.Timestep == 0));
        }