示例#1
0
        public void Init(CLRSharp.ICLRSharp_Environment env)
        {
            if (bInited) return;
            if(bodyNative.HasVariables)
            {
                typelistForLoc = new MethodParamList(env, bodyNative.Variables);
 
            }
        }
示例#2
0
 /// <summary>
 /// 构造函数只是为了把脚本实例传进来,用其他的形式也可以
 /// </summary>
 /// <param name="inst"></param>
 public Base_IMyType(CLRSharp.CLRSharp_Instance inst)
 {
     var context = ThreadContext.activeContext;
     this.inst = inst;
     //这里先把需要的脚本方法记下来,只是为了后面调用起来方便
     var ms = this.inst.type.GetMethodNames();
     foreach (string name in ms)
     {
         if (name.Contains("GetName"))
             _GetName = this.inst.type.GetMethod(name, MethodParamList.constEmpty());
         if (name.Contains("GetDesc"))
             _GetDesc = this.inst.type.GetMethod(name, MethodParamList.constEmpty());
         if (name.Contains("SetName"))
             _SetName = this.inst.type.GetMethod(name, MethodParamList.Make(context.environment.GetType(typeof(string))));
     }
 }
示例#3
0
 /// <summary>
 /// 创建真正的绑定实例
 /// </summary>
 /// <param name="inst">传入的脚本实例</param>
 /// <returns></returns>
 public object CreateBind(CLRSharp.CLRSharp_Instance inst)
 {
     return new Base_IMyType(inst);
 }
示例#4
0
文件: CodeBody.cs 项目: qq1792/LSharp
        public void Init(CLRSharp.ICLRSharp_Environment env)
        {
            if (bInited) return;
            if (bodyNative.HasVariables)
            {
                typelistForLoc = new MethodParamList(env, bodyNative.Variables);
            }
            for (int i = 0; i < bodyNative.Instructions.Count; i++)
            {
                var code = bodyNative.Instructions[i];
                OpCode c = new OpCode();
                c.code = (CodeEx)(int)code.OpCode.Code;
                c.addr = code.Offset;
                if (code.SequencePoint != null)
                {
                    if (debugDoc == null)
                        debugDoc = new Dictionary<string, int>();
                    if (debugDoc.ContainsKey(code.SequencePoint.Document.Url) == false)
                    {
                        debugDoc.Add(code.SequencePoint.Document.Url, code.SequencePoint.StartLine);
                    }
                    c.debugline = code.SequencePoint.StartLine;

                }

                this.opCodes.Add(c);
                addr[c.addr] = i; ;
            }
            var context = ThreadContext.activeContext;
            for (int i = 0; i < bodyNative.Instructions.Count; i++)
            {
                OpCode c = opCodes[i];
                var code = bodyNative.Instructions[i];
                c.InitToken(context, this, code.Operand);
            }
            bInited = true;
        }
示例#5
0
文件: CodeBody.cs 项目: qq1792/LSharp
 //以后准备用自定义Body采集一遍,可以先过滤处理掉Mono.Cecil的代码中的指向,执行会更快
 public CodeBody(CLRSharp.ICLRSharp_Environment env, Mono.Cecil.MethodDefinition _def)
 {
     this.method = _def;
     Init(env);
 }
示例#6
0
文件: Program.cs 项目: qq1792/LSharp
        static object TestOne(CLRSharp.IMethod method, bool LogStep = false, bool notry = false)
        {


            int debug = LogStep ? 9 : 0;
            if (CLRSharp.ThreadContext.activeContext == null)
            {
                CLRSharp.ThreadContext context = new CLRSharp.ThreadContext(env, debug);
            }
            CLRSharp.ThreadContext.activeContext.SetNoTry = notry;
            return method.Invoke(CLRSharp.ThreadContext.activeContext, null, null);
        }
示例#7
0
 protected override void initDBModel(CLRSharp.ICLRType voCLRType = null, string sheet = "", bool order = false)
 {
     base.initDBModel(typeof(CellWarSceneDBVO) as ICLRType, "cell_war_scene");
 }
示例#8
0
 public TestItem(CLRSharp.ICLRType type, string method)
 {
     this.type = type;
     this.method = method;
 }
示例#9
0
文件: Form1.cs 项目: qq1792/LSharp
 void CallMethod(CLRSharp.IMethod method, object _this, params object[] _params)
 {
     CLRSharp.ThreadContext context = CLRSharp.ThreadContext.activeContext;
     method.Invoke(context, _this, _params);
 }
示例#10
0
文件: LevelDBModel.cs 项目: xqy/game
 protected override void initDBModel(CLRSharp.ICLRType voCLRType = null, string sheet = "", bool order = false)
 {
     base.initDBModel(typeof(LevelDBVO) as ICLRType, "level", true);
 }