private void bttest_Click(object sender, EventArgs e) { if (!IsRunOper()) { return; } string acturl = rTBActionUrl.Text.Trim(); string reqdata = rTBdata.Text.Trim(); string method = ((App.ValTxt)cBmethod.SelectedItem).Value.Trim(); string uncode = ((App.ValTxt)cBuncode.SelectedItem).Value.Trim(); string format = ((App.ValTxt)cBformat.SelectedItem).Value.Trim(); string encode = cBencode.Text.Trim(); string contype = cBcontype.Text.Trim(); string errs = ""; string rws = wapp.AppPub.RequestWebServer(acturl, method, contype, encode, reqdata, ref cookie, ref errs); if (errs == "") { if (uncode == "1") { rws = Often.Unescape(rws); } else if (uncode == "2") { rws = Often.UrlDes(rws); } else if (uncode == "3") { rws = Often.DecodeURI(rws); } if (format == "1") { string ferrs = ""; string frws = wapp.AppPub.FormatJsonString(rws, ref ferrs); if (ferrs != "") { rws = "格式化数据发生错误!错误信息:" + ferrs + ",原始数据:\n" + rws; } else { rws = frws; } } rTBout.Text = rws; } else { rTBout.Text = errs; } }
private void btbuild_Click(object sender, EventArgs e) { rBb.Text = ""; string s = rBa.Text.Trim(); if (s == "") { return; } string errs = ""; if (cBrjson.Checked) { s = GetReplaceJson(s); } string jsons = FormatJsonString(s, ref errs); if (errs != "") { rBb.Text = errs; } else { try { if (rBa2.Checked) { jsons = Often.Unescape(jsons); } else if (rBa3.Checked) { jsons = Often.UrlDes(jsons); } else if (rBa4.Checked) { jsons = Often.DecodeURI(jsons); } } catch (Exception ex) { rBb.Text = ex.Message; } rBb.Text = jsons; } }
/// <summary>根据指定的解码模式解码指定的字符串</summary> /// <param name="s">指定的字符串</param> /// <param name="cMode">解码模式,=0:不解码,=1:Html解码,=2:Url解码,=3:Escape解码,=4:EURI解码,=11:Html编码,=12:Url编码,=13:Escape编码,=14:EURI编码</param> /// <returns>根据指定的解码模式解码指定的字符串</returns> public static string GetUnCode(string s, int cMode) { if (cMode == 1) { return(Often.HtmlDecode(s)); } else if (cMode == 2) { return(Often.UrlDes(s)); } else if (cMode == 3) { return(Often.Unescape(s)); } else if (cMode == 4) { return(Often.DecodeURI(s)); } else if (cMode == 11) { return(Often.HtmlEncode(s)); } else if (cMode == 12) { return(Often.UrlEn(s)); } else if (cMode == 13) { return(Often.Escape(s)); } else if (cMode == 14) { return(Often.EncodeURI(s)); } return(s); }
private void bt02b_Click(object sender, EventArgs e) { GetOut(Often.DecodeURI(GetInput())); }