/// <summary> /// chkPass功能:对ks_cmd的check命令的基本验证的一个包装函数,里边的效验方法可以自己添加或修改 /// </summary> /// <param name="connect">参数connect:为0时自动判断是否连接服务器,为1时强制连接服务器 </param> /// <returns></returns> public static string chkPass(int connect = 0) { string sData, randomstr, Srandomstr, errinfo; randomstr = SoftXLic.GetRandomString(); sData = SoftXLic.KS_CMD("check", "<randomstr>" + randomstr + "</randomstr><connect>" + connect.ToString() + "</connect>"); sData = SoftXLic.FD_(sData); if (SoftXLic.GD_(sData, "state") != "100") { errinfo = SoftXLic.GD_(sData, "message"); errinfo = errinfo + "---" + SoftXLic.GD_(sData, "webdata"); MessageBox.Show(errinfo, "验证失败"); SoftXLic.KS_CMD("exit", ""); return(""); } else { Srandomstr = SoftXLic.GD_(sData, "randomstr"); // '服务端返回的randomstr if (Srandomstr != randomstr) //'验证成功,要对数据读取和安全效验了 { SoftXLic.KS_CMD("exit", ""); return(""); } } return(sData); }
public static string advapi(string advapicmd) { string sData, randomstr, Srandomstr, errinfo; randomstr = SoftXLic.GetRandomString(); sData = SoftXLic.KS_CMD("check", "<randomstr>" + randomstr + "</randomstr><advapi>" + advapicmd + "</advapi>"); sData = SoftXLic.FD_(sData); if (SoftXLic.GD_(sData, "state") != "100") { errinfo = SoftXLic.GD_(sData, "message"); errinfo = errinfo + "---" + SoftXLic.GD_(sData, "webdata"); return(errinfo); } else { Srandomstr = SoftXLic.GD_(sData, "randomstr"); if (Srandomstr != randomstr) { SoftXLic.KS_CMD("exit", ""); } } return(SoftXLic.GD_(sData, "advapi")); }