//--------------------------------------------------------------------------------------------------

        public static ScriptInstance LoadScriptFromFile(string filename, ScriptContext contextInstance, bool forceReload = false)
        {
            if (!File.Exists(filename))
            {
                Messages.Error("Script file does not exist: " + filename);
            }

            ScriptInstance scriptInstance;

            if (!forceReload)
            {
                scriptInstance = ScriptCache.Find(filename);
                if (scriptInstance != null)
                {
                    return(scriptInstance);
                }
            }

            scriptInstance = new ScriptInstance(filename, contextInstance);
            if (ScriptCompiler.Compile(scriptInstance))
            {
                return(scriptInstance);
            }
            return(null);
        }
Beispiel #2
0
        //--------------------------------------------------------------------------------------------------

        internal static bool Compile(ScriptInstance scriptInstance)
        {
            var compiler = new ScriptCompiler(scriptInstance);

            if (!compiler._Compile())
            {
                return(false);
            }

            ScriptCache.Add(scriptInstance, compiler._FileList);

            return(true);
        }