public JsonNodeObject GenJson() { JsonNodeObject json = new JsonNodeObject(); json.SetDictValue("name", this.Name); var sha1 = SHA1.Create(); json.SetDictValue("returntype", this.ReturnType); json.SetDictValue("paramcount", this.ParamTypes.Count); JsonNodeArray jsonparams = new JsonNodeArray(); json.SetDictValue("params", jsonparams); for (var i = 0; i < this.ParamTypes.Count; i++) { JsonNodeObject item = new JsonNodeObject(); item.SetDictValue("name", this.ParamTypes[i].Name); item.SetDictValue("type", this.ParamTypes[i].Type); jsonparams.Add(item); } return(json); }
//public Dictionary<string, byte[]> codes = new Dictionary<string, byte[]>(); //public byte[] GetScript(byte[] script_hash) //{ // string strhash = ""; // foreach (var b in script_hash) // { // strhash += b.ToString("X02"); // } // return codes[strhash]; //} public string GenJson() { JsonNodeObject json = new JsonNodeObject(); json["__name__"] = new JsonNodeString("neomodule."); //code var jsoncode = new JsonNodeArray(); json["code"] = jsoncode; foreach (var c in this.total_Codes.Values) { jsoncode.Add(c.GenJson()); } //code bytes var code = this.Build(); var codestr = ""; foreach (var c in code) { codestr += c.ToString("X02"); } json.SetDictValue("codebin", codestr); //calls JsonNodeObject methodinfo = new JsonNodeObject(); json["call"] = methodinfo; foreach (var m in this.mapMethods) { methodinfo[m.Key] = m.Value.GenJson(); } StringBuilder sb = new StringBuilder(); json.ConvertToStringWithFormat(sb, 4); return(sb.ToString()); }