public UtilityFuncMain(Simulator simulator)
     : base(simulator)
 {
     if (_simulator.GetType() != typeof(ScenarioMain))
     {
         throw new ApplicationException("This library is not an MCI simulator.");
     }
 }
        private bool LoadSimulatorLibrary(FileInfo simulatorFile)
        {
            Assembly simFile;

            try
            {
                simFile = Assembly.LoadFrom(simulatorFile.FullName);

                //Type[] mod = simFile.GetTypes();
                Type mainType;

                foreach (Type t in simFile.GetTypes())
                {
                    if (t.Name == "ScenarioMain")
                    {
                        mainType = t;

                        s = (Simulator)simFile.CreateInstance(mainType.FullName);
                        s.OnLogUpdate += Simulator_OnLogUpdate;
                        s.OnSimulationComplete += Simulator_OnSimulationComplete;
                        tsLabel.Text = "Ready";

                        _fSimulator = simulatorFile;
                        EnableSimulator(true);
                        _simulationStatus = SIMULATION_STATUS.READY;

                        PrintSimulationStatus(s.GetMonitoringText());

                        return true;
                    }
                }
            }
            catch (Exception)
            {
                // Error loading simulator file
            }

            return false;
        }