It’s June 1st again, and it’s also the first anniversary of the release of the first open source version of Qing Language. On this memorable day, we bring a new version of Qing Language v1_20240601.
Download the new version: https://qingyuyan.cn/download.html
The main updates are as follows:
1. Platform updated to .Net8
2. The editor adds Windows program packaging function. Since many users have reported that they want to be able to package Qing language programs into executable files, we have added this feature in the new version.
This function essentially packages the Qing language interpreter or Qing programming program and script code into a single exe file. The program resources will be automatically released when running. Currently, it is only supported for use under Windows.
3. Added BindAnno annotation, which is used to bind C# native objects and properties to Qing language objects to facilitate the development of Qing language extension libraries, for example:
// 在扩展库中有如下对象
public class DateObj : Obj {
// 这是之前的写法,需要定义Prop类,并分别实现Qget和Qset方法
class BindYear : Prop {
public BindYear(Obj obj) : base(obj) {}
public override Expr Qget(Ctx? ctx=null) {
……
}
public override Expr Qset(Expr val, Ctx? ctx=null) {
……
}
}
// 通过注解可以直接绑定基本类型的成员
[BindAnno("#备注")]
private string remark;*/
……
}
Types that support annotation binding include bool, int, long, float, double, decimal, and string.
For complex objects, path binding is also supported, as follows:
[BindAnno("#其他", "a.b.c", typeof(DateTime))]
public new object Raw { get; set; }
This approach requires specifying the actual type of the binding object.
4. Encapsulates the code number toast library and provides tool support. The main work direction after Qing Language 1.0 is to enrich the functions of Qing Language through dynamic expansion libraries. This time we have encapsulated some functions of a very excellent tool library in .Net ( Code Toast ) to bring some convenience to everyone. Tool of. We will continue to expand the extension library of Qing Language in the future.
Qingyu-Code Toast Library Instructions for Use
Here are some simple examples:
#库 = @加载动态库、“./数据库连接库.dll”
;数字转换
#库@转中文数字【“123.45”】 ;一百二十三点四五
#库@转中文金额【“123.45”】 ;壹佰贰拾叁元肆角伍分
#库@十进制转任意进制【123,8】 ;十进制转八进制,返回字符串 “173”
#库@任意进制转十进制【“173”,8】 ;八进制转十进制,第一个参数是字符串类型
;农历工具
#库@转农历【“2018-12-31”】 ;支持传入字符串或时间对象,下同
#库@转农历【@系统时间【】】
#库@转生肖【“2018-12-31”】
#库@转干支【“2018-12-31”】
#库@转农历节日【“2018-12-31”】
;多线程下载器
;指定下载路径和保存路径,最后设置线程数,如果不设置则默认为2线程
#下载器 = #库@创建多线程下载器【“https://qing.if4.ttyt.cc/qing/Qing.dll”, “H:\\Qing.dll”, 3】
#下载器#缓存文件夹 = “H:\\”
#下载器@下载进度变更命令 = @【#某】{@显示、#某#总进度}
#下载器@合并完成命令 = @【#某】{@显示、“下载完成了”}
#下载任务 = #下载器@开始下载【】 ;开始下载返回的是异步任务
@等待任务、#下载任务