-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathExample2.cs
58 lines (52 loc) · 1.08 KB
/
Example2.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
using Puerts;
using XLua;
/// <summary>
/// 实例方法调用
/// 逻辑: 无
/// 参数: 无
/// 返回值: 无
/// </summary>
[Test]
[TestGroup("Static vs Instance")]
public class Example2 : IExecute
{
public bool Static => false;
public string Method => "void Payload();";
public CallTarget Target => CallTarget.ScriptCallCSharp;
public object RunCS(int count)
{
var Example = new Example2();
for (var i = 0; i < count; i++)
{
Example.Payload();
}
return null;
}
public object RunJS(JsEnv env, int count)
{
env.Eval(string.Format(
@"(function() {{
var Example = new (require('csharp').Example2)();
for(let i = 0; i < {0}; i++){{
Example.Payload();
}}
}})()", count));
return null;
}
public object RunLua(LuaEnv env, int count)
{
env.DoString(string.Format(
@"
(function()
local Example = CS.Example2();
for i = 1,{0} do
Example:Payload();
end
end)()
", count));
return null;
}
public void Payload()
{
}
}