|
1金钱
ScriptControlClass js = new ScriptControlClass();
js.Language = "JScript";
js.AddCode(textBox2.Text);//JS代码
string result = null;
result = js.Eval(textBox1.Text).ToString(); //调用函数
MessageBox.Show(result);
这样测试可成功
但是用开发助手。转换一下如下
sb.Append("eval('result=\"' + result + '\"');");
sb.Append("return result");
sb.Append("}");
sb.Append("function getEncryption(password, uin, vcode) {");
sb.Append("var str1 = hexchar2bin(md5(password));");
sb.Append("var str2 = md5(str1 + uin2hex(uin));");
sb.Append("var str3 = md5(str2 + vcode.toUpperCase());");
sb.Append("return str3");
sb.Append("}");
#endregion
string A="getEncryption(\"qqaaa123..\", \"25367\", \"SSFE\")";
ScriptControlClass js = new ScriptControlClass();
js.Language = "JScript";
js.AddCode(sb.ToString());//JS代码
string result = null;
result = js.Eval(A).ToString(); //调用函数
MessageBox.Show(result);
|
|