C#下的JS脚本引擎ReoScript
来源:互联网 发布:plc编程题目 编辑:程序博客网 时间:2024/05/01 00:09
在上一篇博文中,我写了一篇关于开源的表格控件ReoGrid的文章,点这里
我大致研究了一下它的执行脚本那块的功能,发现它使用了一个叫ReoScript的脚本引擎,并且也是一个开源项目,点这里
通过上图,可以清晰的看到这个引擎的使用过程。
下面为集成到.net开发环境中的方法
Run your script
Prepare script, and run it by using ScriptRunningMachine:
Result:
There are some basic features provided by ReoScript core, such as Array.
Result:
Add your objects and functions into script
3 ways to add objects and functions
Proxy objects
Without modifying your existed objects, add proxy objects for .NET objects will make it available in script. There is a .NET class named 'Car' and its proxy class named 'CarProxy', the 'CarProxy' class only be used for script.And there is a proxy class which provided for script:
Then run script:
Using ScriptVisible Attribute
Add 'ScriptVisible' attribute to class, field, property and method will make it visible to script.this feature available since v1.4
DirectAccess mode (.NET Reflection)
No need to write anything, just enable the DirectAccess mode of ScriptRunningMachin.Choose a way to integrate with your Application
Here are some tips that you can reference.- Proxy objects - Although proxy objects need to be written, but this mode has a good reliability and it is very safety. If you are planning to provide script available for your end-user then you may choose this.
- ScriptVisible - There is a few difficult to control what objects and properties to be available in script. Consider that risk and choose this mode.
- DirectAccess - This mode mix the world between .NET and Script, and script may become unavailable after you changed the appearance of .NET objects. So make sure that script available and choose this mode.
Setup
1. Download ReoScript binary or build source file. Add the following DLLs into reference list of your project.2. Import the following namespace
3. Create ScriptRunningMachine and run script
0 0
- C#下的JS脚本引擎ReoScript
- ReoScript引擎的简单使用
- ReoScript引擎的Lambda表达式
- ReoScript引擎的Lambda表达式
- delphi下的脚本引擎
- 创建一个简单的C#脚本引擎
- 解析JS的脚本解析引擎
- J2me下的MNS脚本引擎
- CScript 错误: 无法找到脚本“...js”的脚本引擎“JScript”
- (微软脚本引擎)C#利用msscript.ocx控件执行JS脚本
- 纯c#编写的脚本引擎(非CodeDom)
- 虚幻引擎的C#脚本插件 UnrealCS Demo指南
- 没有文件扩展“.js”的脚本引擎--解决办法(downmoon)
- 没有文件扩展“.js”的脚本引擎问题解决
- 输入错误: 没有文件扩展“.js”的脚本引擎
- 没有文件扩展“.js”的脚本引擎 解决
- 如何解决没有文件扩展“.js”的脚本引擎
- 没有文件扩展“.js”的脚本引擎问题解决
- Mysql安装过程问题总结及处理方法
- java变量、进制、数据类型-20141227002
- Java api在线
- awk简单使用
- nyoj 477 a+bproblem
- C#下的JS脚本引擎ReoScript
- mysql 分区与分表
- 字典树(trie树)、后缀树
- Oracle设置和修改system和scott的口令,并且如何连接到system和scott模式下
- java反射
- BASH快速入门手册
- 秒杀的问题
- mysql
- Linux 下的一个全新的性能测量和调式诊断工具 Systemtap, 第 3 部分: Systemtap