Example #1
0
        public static object CallScript(string code, object host, string function = null, params object[] arguments)
        {
            object script = HostedScriptSite.HostScript(host, code);

            if (function == null)
            {
                return(script);
            }
            return(script.GetType().InvokeMember(function, BindingFlags.InvokeMethod, null, script, arguments));
        }
Example #2
0
 protected object ActivateScript(string scriptFile, bool startup = false)
 {
     using (TextReader reader = File.OpenText(scriptFile))
     {
         object script = HostedScriptSite.HostScript(this, reader.ReadToEnd());
         if (startup)
         {
             this.Active = script;
         }
         return(script);
     }
 }