Exemplo n.º 1
0
        public static Object Execute(this ScriptSource aScriptSource, ESCompilerOptions compilerOptions, ErrorListener errorListener, ScriptScope scriptScope, Object[] arguments)
        {
            var compiledCode      = aScriptSource.Compile(compilerOptions, errorListener);
            var essenceScriptCode = compiledCode.essenceScriptCode();

            if (essenceScriptCode == null)
            {
                return(null);
            }
            return(essenceScriptCode.Run(scriptScope.scope(), arguments));
        }
Exemplo n.º 2
0
        public static Object Execute(this ScriptSource aScriptSource, ScriptScope scriptScope, Object[] arguments)
        {
            var compiledCode      = aScriptSource.Compile();
            var essenceScriptCode = compiledCode.essenceScriptCode();

            if (essenceScriptCode == null)
            {
                return(null);
            }
            return(essenceScriptCode.Run(scriptScope.scope(), arguments));
        }
Exemplo n.º 3
0
        public static Object Execute(this ScriptSource aScriptSource, ESCompilerOptions compilerOptions, Object[] arguments)
        {
            var compiledCode      = aScriptSource.Compile(compilerOptions);
            var essenceScriptCode = compiledCode.essenceScriptCode();

            if (essenceScriptCode == null)
            {
                return(null);
            }
            return(essenceScriptCode.Run(arguments));
        }
Exemplo n.º 4
0
        public static Object Execute(this ScriptSource aScriptSource, ErrorListener errorListener, Object[] arguments)
        {
            var compiledCode      = aScriptSource.Compile(errorListener);
            var essenceScriptCode = compiledCode.essenceScriptCode();

            if (essenceScriptCode == null)
            {
                return(null);
            }
            return(essenceScriptCode.Run(arguments));
        }
Exemplo n.º 5
0
 /// <summary>
 /// Run the script and import all the variables/functions/objects to scope
 /// </summary>
 /// <param name="path">path to python script</param>
 /// <returns>True if file found and loaded, false otherwise</returns>
 /// <remarks>No errors will be raised in case the file does not exist</remarks>
 public bool LoadScript(string path)
 {
     if (my.FileSystem.FileExists(path))
     {
         Debug.Print("loading script " + path.Split('\\').Last());
         gScript = Engine.CreateScriptSourceFromFile(path);
         gScript.Compile();
         gScript.Execute(EngineScope);
         return(true);
     }
     return(false);
 }
Exemplo n.º 6
0
        public static Object Execute(this ScriptSource aScriptSource, ESCompilerOptions compilerOptions, ErrorListener errorListener, ScriptScope scriptScope, Object[] arguments, out TimeSpan durationToRun)
        {
            var compiledCode      = aScriptSource.Compile(compilerOptions, errorListener);
            var essenceScriptCode = compiledCode.essenceScriptCode();

            if (essenceScriptCode == null)
            {
                durationToRun = TimeSpan.Zero;
                return(null);
            }
            var value = essenceScriptCode.Run(scriptScope.scope(), arguments);

            durationToRun = essenceScriptCode.DurationToRun;
            return(value);
        }
Exemplo n.º 7
0
 /// <summary>
 /// Run the script and import all the variables/functions/objects to scope
 /// </summary>
 /// <param name="path">path to python script</param>
 /// <returns>True if file found and loaded, false otherwise</returns>
 /// <remarks>No errors will be raised in case the file does not exist</remarks>
 public bool LoadScript(string path)
 {
     if (my.FileSystem.FileExists(path))
     {
         gScript = Engine.CreateScriptSourceFromFile(path);
         gScript.Compile();
         gScript.Execute(EngineScope);
         return true;
     }
     return false;
 }