public void BeginDebug() {//打开Log this.FullLog = new FullLog(); var sm = this.service as StateMachine; if (sm != null) { sm.BeginDebug(this.FullLog); } }
//public void LoadScript(string hash) //{ // if (script == null) // { // script = new LogScript(hash); // curScript = script; // } // else // { // curOp.subScript = new LogScript(hash); // curOp.subScript.parent = curScript; // curScript = curOp.subScript; // } //} //public void NextOp(int addr, VM.OpCode op) //{ // LogOp _op = new LogOp(addr, op); // curScript.ops.Add(_op); // curOp = _op; // if (op == VM.OpCode.RET || op == VM.OpCode.TAILCALL) // { // curScript = curScript.parent; // } //} //public void OPStackRecord(Op[] records) //{ // curOp.stack = records; //} //public void OpResult(StackItem item) //{ // curOp.opresult = item; //} //public void Error(string info) //{ // this.error = info; //} //public void Finish(VMState state) //{ // this.state = state; //} //public void Save(string filename) //{ // var path = System.IO.Path.GetDirectoryName(filename); // if (System.IO.Directory.Exists(path) == false) // System.IO.Directory.CreateDirectory(path); // System.IO.File.Delete(filename + ".json"); // System.IO.File.Delete(filename); // var json = new MyJson.JsonNode_Object(); // json.SetDictValue("script", script.ToJson()); // if (string.IsNullOrEmpty(error) == false) // json.SetDictValue("error", error); // json.SetDictValue("VMState", state.ToString()); // StringBuilder sb = new StringBuilder(); // json.ConvertToStringWithFormat(sb, 0); // System.IO.File.WriteAllText(filename + ".json", sb.ToString()); // var compressor = new SevenZip.SevenZipCompressor(); // compressor.CompressionMethod = SevenZip.CompressionMethod.Lzma2; // compressor.CompressionLevel = SevenZip.CompressionLevel.Fast; // compressor.FastCompression = true; // //compressor.path = path; // compressor.CompressFiles(filename, System.IO.Path.GetFullPath(filename + ".json")); // System.IO.File.Delete(filename + ".json"); //} public static FullLog FromJson(MyJson.JsonNode_Object json) { FullLog fulllog = new FullLog(); if (json.ContainsKey("error")) { fulllog.error = json["error"].AsString(); } if (json.ContainsKey("VMState")) { var state = json["VMState"].AsString(); fulllog.state = (VMState)Enum.Parse(typeof(VMState), state); } if (json.ContainsKey("script")) { fulllog.script = LogScript.FromJson(json["script"] as MyJson.JsonNode_Object); } return(fulllog); }
public void BeginDebug() {//打开Log this.FullLog = new FullLog(); }