Releases: ldqk/Masuit.Tools
Releases · ldqk/Masuit.Tools
2.6.6.2
2.6.6
2.6.5
- 新增反病毒扫描函数
// 要求系统WindowsDefender没有被精简掉
var windowsDefender = new WindowsDefenderScanService();
var result = windowsDefender.ScanFile(@"Y:\1.exe"); // 扫描文件
var result = windowsDefender.ScanDirectory(@"Y:\"); // 扫描文件夹
var result = windowsDefender.ScanStream(stream); // 扫描文件流
// 要求C:\Windows\System32\amsi.dll文件存在
var amsiService = new AmsiScanService();
amsiService.Scan(stream); // 扫描文件流
amsiService.Scan(@"Y:\1.exe"); // 扫描文件
amsiService.Scan(bytes); // 扫描二进制数组
// ASP.NET Core
service.AddWindowsDefender();
service.AddAMSI();
- 优化FromBodyOrDefaultModelBinder
- 优化生成验证码图片
2.6.4
2.6.2.8
2.6.2
2.6.1
让动态类型支持属性访问器和索引器调用
var obj = DynamicFactory.NewObject();
obj.Name = "Masuit";
obj.Age = 18;
obj.MyClass = DynamicFactory.WithObject(new
{
X = 10,
Y = 20,
Z = new List<int> { 1, 2, 3, 4, 5 }
});
Assert.Equal(obj.Name, obj["Name"]);
Assert.Equal(obj["MyClass"]["X"], obj.MyClass.X);
Assert.Equal(obj.MyClass.Z[2], obj["MyClass"]["Z"][2]);
普通类型转换成动态类型
var obj = new
{
Name = "Masuit"
}.ToDynamic();
obj.Age = 18;
obj.MyClass = new
{
X = 10,
Y = 20,
Z = new List<int> { 1, 2, 3, 4, 5 }
}.ToDynamic();
obj.Prop = "test";
_ = obj - "Prop"; // 删除属性
Assert.Equal(obj.Name, obj["Name"]);
Assert.Equal(obj["MyClass"]["X"], obj.MyClass.X);