コード例 #1
0
ファイル: _DebugOutput.cs プロジェクト: ikvm/neondebug
        public static void DebugOutputToService(string hash, byte[] avm, string abi, string map, string cs)
        {
            System.Net.WebClient wc = new WebClient();
            try
            {
                System.Collections.Specialized.NameValueCollection vs = new System.Collections.Specialized.NameValueCollection();
                vs["jsonrpc"] = "2.0";
                vs["id"]      = "1";
                vs["method"]  = "setcontractscript";
                MyJson.JsonNode_Array array = new MyJson.JsonNode_Array();

                StringBuilder sb = new StringBuilder();
                foreach (var d in avm)
                {
                    sb.Append(d.ToString("x02"));
                }

                array.Add(new MyJson.JsonNode_ValueString(hash));
                array.Add(new MyJson.JsonNode_ValueString(sb.ToString()));
                array.Add(new MyJson.JsonNode_ValueString(Uri.EscapeDataString(cs)));
                array.Add(new MyJson.JsonNode_ValueString(map));
                array.Add(new MyJson.JsonNode_ValueString(abi));
                vs["params"] = array.ToString();

                var ret = wc.UploadValues("https://apiaggr.nel.group/api/testnet", vs);
                new DefLogger().Log(System.Text.Encoding.UTF8.GetString(ret));
            }
            catch (Exception err)
            {
                new DefLogger().Log(err.ToString());
            }
        }
コード例 #2
0
 public MyJson.JsonNode_Object GenJson()
 {
     MyJson.JsonNode_Object json = new MyJson.JsonNode_Object();
     json.SetDictValue("name", this.name);
     json.SetDictValue("returntype", this.returntype);
     json.SetDictValue("paramcount", this.paramtypes.Count);
     MyJson.JsonNode_Array jsonparams = new MyJson.JsonNode_Array();
     json.SetDictValue("params", jsonparams);
     for (var i = 0; i < this.paramtypes.Count; i++)
     {
         MyJson.JsonNode_Object item = new MyJson.JsonNode_Object();
         item.SetDictValue("name", this.paramtypes[i].name);
         item.SetDictValue("type", this.paramtypes[i].type);
         jsonparams.Add(item);
     }
     return(json);
 }
コード例 #3
0
        //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()
        {
            MyJson.JsonNode_Object json = new MyJson.JsonNode_Object();
            json["__name__"] = new MyJson.JsonNode_ValueString("neomodule.");

            //code
            var jsoncode = new MyJson.JsonNode_Array();

            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
            MyJson.JsonNode_Object methodinfo = new MyJson.JsonNode_Object();
            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());
        }