Exemplo n.º 1
0
        /// <summary>
        /// Get a script engine instance
        /// </summary>
        /// <param name="engine">The engine name</param>
        /// <param name="enableDebug">Whether to enable debug of the engine</param>
        /// <returns>The script engine</returns>
        public static IScriptEngine GetScriptEngine(string engine, bool enableDebug)
        {
            IScriptEngine se         = null;
            string        engineName = engine.ToLowerInvariant();

            if (engineName == "assembly")
            {
                // Hard code assembly script engine
                se = new AssemblyScriptEngine();
            }
            else
            {
                if (_engines.ContainsKey(engineName))
                {
                    se = (IScriptEngine)Activator.CreateInstance(_engines[engineName].type, new object[] { enableDebug });
                }
            }
            return(se);
        }
Exemplo n.º 2
0
        /// <summary>
        /// Get a script engine instance
        /// </summary>
        /// <param name="engine">The engine name</param>
        /// <param name="enableDebug">Whether to enable debug of the engine</param>
        /// <returns>The script engine</returns>
        public static IScriptEngine GetScriptEngine(string engine, bool enableDebug)
        {
            IScriptEngine se = null;
            string engineName = engine.ToLowerInvariant();

            if (engineName == "assembly")
            {
                // Hard code assembly script engine
                se = new AssemblyScriptEngine();
            }
            else
            {
                if (_engines.ContainsKey(engineName))
                {
                    se = (IScriptEngine)Activator.CreateInstance(_engines[engineName].type, new object[] { enableDebug });
                }
            }
            return se;
        }