예제 #1
0
    object DoStaticMethod(CLRSharp.ThreadContext context, string type, string method)
    {
        CLRSharp.ICLRType wt = env.GetType(type);

        CLRSharp.IMethod methodctor = wt.GetMethod(method, CLRSharp.MethodParamList.constEmpty());//取得构造函数
        return(methodctor.Invoke(context, null, null));
    }
예제 #2
0
    public static object CreateObject(ThreadContext context, string name)
    {
        var wt = HotFixScript.env.GetType(name);

        CLRSharp.CLRSharp_Instance to         = new CLRSharp.CLRSharp_Instance(wt as CLRSharp.ICLRType_Sharp); //创建实例
        CLRSharp.IMethod           methodctor = wt.GetMethod(".ctor", CLRSharp.MethodParamList.constEmpty());  //取得构造函数
        methodctor.Invoke(context, to, null);                                                                  //执行构造函数
        return(to);
    }
예제 #3
0
 void InvokeMethod(CLRSharp.ThreadContext context, string type, string method)
 {
     CLRSharp.ICLRType          wt         = env.GetType(type);                                             //用全名称,包括命名空间
     CLRSharp.CLRSharp_Instance to         = new CLRSharp.CLRSharp_Instance(wt as CLRSharp.ICLRType_Sharp); //创建实例
     CLRSharp.IMethod           methodctor = wt.GetMethod(".ctor", CLRSharp.MethodParamList.constEmpty());  //取得构造函数
     methodctor.Invoke(context, to, null);                                                                  //执行构造函数
     CLRSharp.IMethod mt = wt.GetMethod(method, CLRSharp.MethodParamList.constEmpty());
     mt.Invoke(context, to, null);
 }