public Dictionary <string, object> GetGroupInfoFromQun() { var furl = qq_qun_group; string para = "bkn=" + _user.GTK; string fresult = _helper.GetUrlText(furl, Encoding.UTF8.GetBytes(para), _baseRefer); return(QQHelper.FromJson <Dictionary <string, object> >(fresult)); }
public Dictionary <string, object> GetMemberInfoFromQun(long gcode, int st, int end) { var furl = qq_qun_member; string para = "gc=" + gcode + "&st=" + st + "&end=" + end + "&sort=0&bkn=" + _user.GTK; string fresult = _helper.GetUrlText(furl, Encoding.UTF8.GetBytes(para), _baseRefer); var dict = QQHelper.FromJson <Dictionary <string, object> >(fresult); return(dict); }
public Dictionary <string, object> GetMyInfo() { var furl = string.Format(qq_qun_myinfo, _user.GTK); string fresult = _helper.GetUrlText(furl, null, _baseRefer); var dict = QQHelper.FromJson <Dictionary <string, object> >(fresult); if ((int)dict["retcode"] == 0) { var data = dict["data"] as Dictionary <string, object>; if (data != null) { _user.Uin = data["uin"].ToString(); _user.QQNum = data["uin"].ToString(); _user.QQName = (string)data["nickName"]; } } return(dict); }
public void AnylizeCookie(string cookie) { var cks = cookie.Split(new[] { ';' }, StringSplitOptions.None); foreach (var ck in cks) { var kv = ck.Trim().Split(new[] { '=' }, StringSplitOptions.None); if (kv.Length == 2) { if (kv[0] == "skey") { _user.skey = kv[1]; _user.GTK = QQHelper.getGTK(_user.skey); } else if (kv[0] == "uin") { var uin = kv[1].TrimStart(new[] { 'o', '0' }); _user.QQNum = uin; _user.Uin = uin; } else if (kv[0] == "ptnick_" + _user.QQNum) { var utf8name = kv[1]; if (!string.IsNullOrWhiteSpace(utf8name)) { if (utf8name.Length % 2 == 0) { var bytes = new byte[utf8name.Length / 2]; for (int i = 0; i < utf8name.Length; i += 2) { bytes[i / 2] = byte.Parse(utf8name.Substring(i, 2), System.Globalization.NumberStyles.HexNumber); } _user.QQName = Encoding.UTF8.GetString(bytes); } } } _cookiecontainer.Add(new Cookie(kv[0], kv[1], "/", "qq.com")); _cookiecontainer.Add(new Cookie(kv[0], kv[1], "/", "qun.qq.com")); _cookiecontainer.Add(new Cookie(kv[0], kv[1], "/", "ptlogin2.qq.com")); } } }
private void GetQunMember(QunGroup group, WaitHandle waitHandle) { var gmlist = new List <QunGroupMember>(); gmlist.Clear(); var st = 0; var per = 20; var count = per + 1; var end = 0; var rand = new Random(); while (st < count) { if (count - st > per) { end = st + per; } else { end = count - 1; } var list = _qq.GetMemberInfoFromQun(group.gcode, st, end); if ((int)list["ec"] == 0) { if (list.ContainsKey("count")) { count = Convert.ToInt32(list["count"]); } if (list.ContainsKey("mems") && list["mems"] is ArrayList mems) { foreach (Dictionary <string, object> item in mems) { var member = new QunGroupMember { role = (int)item["role"], card = (string)item["card"], uin = Convert.ToInt64(item["uin"]), nick = (string)item["nick"], jtime = QQHelper.ToTime(Convert.ToInt64(item["join_time"])).ToString("yyyy-MM-dd HH:mm:ss"), stime = QQHelper.ToTime(Convert.ToInt64(item["last_speak_time"])).ToString("yyyy-MM-dd HH:mm:ss"), }; gmlist.Add(member); } SetInfo("GetGroupMember:" + group.gname + "[" + group.gcode + "] " + st + " > " + end + " = " + mems.Count); } } st = end + 1; try { if (!waitHandle.WaitOne(100)) { continue; } else { SetInfo("GetGroupMember Cancel:" + group.gname + "[" + group.gcode + "]"); return; } } catch { SetInfo("GetGroupMember Cancel:" + group.gname + "[" + group.gcode + "]"); return; } } gmlist.Sort((l, r) => { if (l == r) { return(0); } else if (l.role != r.role) { return(l.role.CompareTo(r.role)); } return(l.uin.CompareTo(r.uin)); }); group.gmlist = gmlist; SetInfo("GetGroupMember OK:" + group.gmlist.Count + "-" + group.gname + "[" + group.gcode + "]"); }