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)); }
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); } }