Example #1
0
        public void Load(string _pathlog, string _pathscript, string transid)
        {
            this.pathScript = _pathscript;
            if (transid.ToLower().IndexOf("0x") == 0)
            {
                transid = transid.Substring(2);
            }
            byte[] info     = HexString2Bytes(transid);
            var    filename = "0x" + ToHexString(info);

            var tranfile = System.IO.Path.Combine(_pathlog, filename + ".llvmhex.txt");


            if (System.IO.File.Exists(tranfile) == false)
            {
                throw new Exception("load file error");
            }
            var str = System.IO.File.ReadAllText(tranfile);
            var bts = ThinNeo.Helper.HexString2Bytes(str);

            using (var ms = new System.IO.MemoryStream(bts))
            {
                var outms = llvm.QuickFile.FromFile(ms);
                var text  = System.Text.Encoding.UTF8.GetString(outms.ToArray());
                var json  = MyJson.Parse(text) as MyJson.JsonNode_Object;
                dumpInfo = SmartContract.Debug.DumpInfo.FromJson(json);
            }
            //循环所有的
            simvm.Execute(dumpInfo);
        }
Example #2
0
        public void Execute(SmartContract.Debug.DumpInfo DumpInfo)
        {
            State runstate = new State();

            runstate.SetId(0);

            stateClone = new Dictionary <int, State>();
            mapState   = new Dictionary <SmartContract.Debug.LogOp, int>();
            careinfo   = new List <CareItem>();

            regenScript = new SmartContract.Debug.LogScript(DumpInfo.script.hash);
            lastScript  = regenScript;

            ExecuteScript(runstate, DumpInfo.script);
        }