forked from florentbr/SeleniumBasic
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathScriptModule.cs
More file actions
31 lines (25 loc) · 930 Bytes
/
ScriptModule.cs
File metadata and controls
31 lines (25 loc) · 930 Bytes
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
using Interop.MSScript;
using System;
using System.Reflection;
using System.Runtime.InteropServices;
namespace vbsc {
class ScriptModule {
private IMSScriptModule _msc_module;
private Type _msc_type;
public ScriptModule(IMSScriptModule msc_module) {
_msc_module = msc_module;
_msc_type = msc_module.GetType();
}
public object Run(string procedure, object[] arguments) {
object[] invokeArgs;
if (arguments != null && arguments.Length != 0) {
invokeArgs = new object[1 + arguments.Length];
Array.Copy(arguments, 0, invokeArgs, 1, arguments.Length);
} else {
invokeArgs = new[] { procedure };
}
invokeArgs[0] = procedure;
return _msc_type.InvokeMember("Run", BindingFlags.InvokeMethod, null, _msc_module, invokeArgs);
}
}
}