public JavaScriptInterpreter() { Console.Write("Loading JavaScript interpreter: "); try { m_engine = new JintEngine(); m_engine.AllowClr = false; m_engine.DisableSecurity(); Console.WriteLine("done."); } catch (Exception e) { Console.WriteLine("FAIL."); Console.WriteLine("Unable to load JavaScript engine\n*********************************************\n\t" + e.Message + "\n*********************************************"); } }
public void init() { en = new JintEngine(); en.DisableSecurity(); en.AllowClr = true; en.SetFunction("print", new Action<object>(Console.WriteLine)); en.SetFunction("alert", new Action<object>(n=>{ MessageBox.Show(n.ToString()); })); //en.SetFunction("cs_exe", new Action<string>(Exe)); //en.SetFunction("cs_exe", new Action<string, string>(Exe)); //en.SetFunction("cs_exeWait", new Action<string, string, string>(ExeWait)); //en.SetFunction("cs_exe", new Action<string, string, string>(Exe)); en.SetFunction("cs_exeWait", new Action<string, string, bool, string>(ExeWait)); en.SetFunction("cs_process", new Action<string, string, bool, string>(ExeWait)); }
public virtual void InjectDefaultCode() { Interpreter = new JintEngine(); Interpreter.DisableSecurity(); Interpreter.SetFunction("AddHook", new AddHookDelegate(AddHook)); Interpreter.SetFunction("AddShortcut", new AddHookDelegate(AddShortcut)); Interpreter.SetFunction("Color", new NewColorDelegate(NewColor)); Interpreter.SetFunction("Vector2", new NewVectorDelegate(NewVector)); Interpreter.SetFunction("AddVectors", new VectorOperationsDelegate(AddVectors)); Interpreter.SetFunction("SubtractVectors", new VectorOperationsDelegate(SubtractVectors)); Interpreter.SetFunction("MultiplyVectors", new VectorOperationsDelegate(MultiplyVectors)); Interpreter.SetFunction("DivideVectors", new VectorOperationsDelegate(DivideVectors)); }