Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- protected void callMethod(String caller = null)
- {
- if (caller == null) { return; }
- Console.WriteLine("Call: " + caller);
- Match match = Regex.Match(
- caller,
- @"jsc:\/\/(?<cls>\w+):(?<name>\w+)@?"
- );
- if (match.Groups.Count >= 2)
- {
- String cls = match.Groups[1].Value;
- String method = match.Groups[2].Value;
- Object[] args = caller.Replace(
- match.Groups[0].Value, ""
- ).Split(',');
- // типы
- try
- {
- Type clsType = Type.GetType("Xphp.Plugins." + cls);
- MethodInfo methodType = clsType.GetMethod(method);
- Object target = this.getPluginInstance(clsType);
- methodType.Invoke(
- target,
- args
- );
- }
- catch (Exception exc)
- {
- Console.WriteLine("Runtime Xphp Reflection exception: " + exc.Message.ToString());
- }
- }
- }
- protected Object getPluginInstance(Type type)
- {
- ConstructorInfo ctor = type.GetConstructor(new[] {
- typeof(MainForm),
- typeof(WebKitBrowser)
- });
- return ctor.Invoke(new object[] {
- this,
- this.browser
- });
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement