private static void InitializeScriptEngine() { IScriptEngineContext context = ScriptEngineContext.Current; context.RegisterType("DateTime", typeof(DateTime)); context.RegisterType("Guid", typeof(Guid)); context.RegisterType("Query", typeof(Query)); context.RegisterType("Workflow", typeof(Workflow)); context.RegisterType("DialogResult", typeof(Dialog.Result)); context.RegisterType("Dictionary", ValueStackContext.Current.CreateDictionary().GetType()); context.RegisterType("List", typeof(System.Collections.ArrayList)); context.RegisterType("HttpRequest", typeof(HttpRequest)); }
public ExecutionVisitor(Options options, IScriptEngineContext context) { this.scriptEngineContext = context; this.methodInvoker = context.GetMethodInvoker(this);//new CachedMethodInvoker(this); this.propertyGetter = new CachedReflectionPropertyGetter(methodInvoker); this.constructorInvoker = new CachedConstructorInvoker(methodInvoker); this.typeResolver = context.GetTypeResolver();//new CachedTypeResolver(); this.fieldGetter = new CachedReflectionFieldGetter(methodInvoker); GlobalScope = new JsObject(); Global = new JsGlobal(this, options); GlobalScope.Prototype = Global as JsDictionaryObject; EnterScope(GlobalScope); CallStack = new Stack<string>(); }
public static void Init(IScriptEngineContext context) { Current = context; }