public static string GetHandon() { string result = ""; if (Global.isHDPassive()) { string url = Global.url_recv; string url_param = "action=handon"; url_param += "&classid=0"; url_param += "&courseid=0"; url_param += "&lessonid=0"; string ret = HTTPReq.HttpGet(url + url_param); Log.Debug("HD_Handon: " + url + url_param + ", ret=" + ret); CBInfo cb = JsonOper.DeserializeJsonToObject <CBInfo>(ret.Replace("(", "").Replace(")", "")); if (cb != null && cb.data.Length > 0) { result = cb.data.Replace("-", ""); if (result.EndsWith("|")) { result = result.Substring(0, result.Length - 1); } } } else { result = Httpd.PopMQ_Handon(); } return(result); }
private void Theout(object sender, System.Timers.ElapsedEventArgs e) { if (Interlocked.Exchange(ref inTimer, 1) == 0) { string json = HTTPReq.HttpGet(Global.url_recv + "action=xiti.get&classid=0&lessonid=0&xitiid=0"); if (json.Length > 55) { log.Info("Theout() xiti.get=" + json); } CBInfo cb = JsonOper.DeserializeJsonToObject <CBInfo>(json.Replace("(", "").Replace(")", "")); if (cb != null && cb.data.Length > 0) { string data = cb.data; string context = ""; for (int i = 0; i < data.Split('|').Length - 1; i++) { int num = Convert.ToInt16(data.Split('|')[i].Split(':')[0].ToString().Replace("-", "")); string answer = data.Split('|')[i].Split(':')[1]; int _answerLen = answer.Split(';').Length; string getAnswer = ""; if (_answerLen == 1) { getAnswer = answer.Split(';')[_answerLen - 1].Split(',')[1]; } else { getAnswer = answer.Split(';')[_answerLen - 2].Split(',')[1]; } context = num + ":" + getAnswer; for (int j = 0; j < al.Count; j++) { PictureBox lb = (PictureBox)al[j]; PictureBox text = (PictureBox)alText[j]; if ((num - 1) == j && (int)clickstate[j] == 0) { LabelStateEvent(context, lb, text, j + 1); clickstate[j] = 1; } } } } Interlocked.Exchange(ref inTimer, 0); } }
/// <summary> /// 采集器----GetXiti /// </summary> public static string GetXitiResult(bool bClear = false) { Log.Debug("GetXitiResult()_1 "); string ret = ""; if (Global.isHDPassive()) { Log.Info("GetXitiResult()_2 "); string url = Global.url_recv; string url_param = "action=xiti.get"; url_param += "&classid=0"; url_param += "&courseid=0"; url_param += "&lessonid=0"; if (bClear) { Thread thread = new Thread(delegate() { ret = HTTPReq.HttpGet(url + url_param); Log.Info("HD_Async_Xiti: " + url + url_param + ", ret=" + ret); }); thread.Start(); } else { string json = HTTPReq.HttpGet(url + url_param); Log.Info("HD_Xiti_Passive: " + url + url_param + ", json=" + json); CBInfo cb = JsonOper.DeserializeJsonToObject <CBInfo>(json.Replace("(", "").Replace(")", "")); if (cb != null && cb.data.Length > 0) { string data = cb.data; for (int i = 0; i < data.Split('|').Length - 1; i++) { int num = Convert.ToInt16(data.Split('|')[i].Split(':')[0].ToString().Replace("-", "")); string answer = data.Split('|')[i].Split(':')[1]; //57A299E5,A;57A299E5,B;57A299E6,C;57A299E6,D;57A299E6,S string[] szKey = answer.Split(';'); SortedSet <string> keySet = new SortedSet <string>(); for (int k = 0; k < szKey.Length; k++) { string _answer = szKey[k].Split(',')[1]; if (_answer == "S") { continue; } if (!keySet.Contains(_answer)) { keySet.Add(_answer); } } string keys = ""; foreach (string key in keySet) { keys += key; } if (keys.Length == 0) { continue; } string context = num + ":" + keys; ret += (ret.Length > 0 ? "|" : "") + context; } } } } else { if (bClear) { Log.Debug("GetXitiResult()_2, Clear..."); string data = Httpd.ClearMQ_Xiti(); if (data.Length > 0) { Common.uploadInvalidXitiResult(data); } } else { Log.Debug("GetXitiResult()_3_1, Pop..."); ret = Httpd.PopMQ_Xiti(); Log.Debug("GetXitiResult()_3_2, Pop..." + ret); } } return(ret); }