private void ExportGroupMember(QunGroup group, string filename) { List <string> lines = new List <string> { string.Format("{0}[{1}] 群信息:", group.gname, group.gcode) }; var lastRole = -1; if (group.gmlist != null) { foreach (var gm in group.gmlist) { if (gm.role != lastRole) { if (gm.role == 0) { lines.Add("创建者:"); } else if (gm.role == 1) { lines.Add("管理员:"); } else { lines.Add("成员:"); } lastRole = gm.role; } lines.Add($"\t{gm.card}({gm.nick})[{gm.uin}] - {gm.jtime} - {gm.stime}"); } } File.WriteAllLines(filename, lines); SetInfo("ExportGroupMember OK:" + filename); }
private void GetQunGroup(WaitHandle waitHandle) { var list = _qq.GetGroupInfoFromQun(); if ((int)list["ec"] == 0) { _qglist.Clear(); foreach (var role in QunGroupRole) { if (list.ContainsKey(role.Key)) { var items = list[role.Key] as ArrayList; if (items != null) { foreach (Dictionary <string, object> item in items) { var friend = new QunGroup { role = role.Key, owner = Convert.ToInt64(item["owner"]), gcode = Convert.ToInt64(item["gc"]), gname = (string)item["gn"], }; _qglist.Add(friend); } } } } } SetInfo("GetGroup OK:" + _qglist.Count); }
private void RefreshGroupinfoUI(QunGroup group) { if (InvokeRequired) { BeginInvoke(new Action <QunGroup>(RefreshGroupinfoUI), group); return; } if (group == null) { richTextBox1.Text = string.Empty; return; } richTextBox1.Text = string.Format(@"groupcode: {0} groupname: {1}", group.gcode, group.gname); }
private void RefreshMemberUI(QunGroup group) { if (InvokeRequired) { BeginInvoke(new Action <QunGroup>(RefreshMemberUI), group); return; } treeViewm.Nodes.Clear(); treeViewm.BeginUpdate(); if (group != null && group.gmlist != null) { foreach (var gm in group.gmlist) { treeViewm.Nodes.Add(new TreeNode(string.Format("{0}[{1}]", string.IsNullOrEmpty(gm.card) ? gm.nick : gm.card, gm.uin)) { Tag = gm }); } } treeViewm.EndUpdate(); }
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 + "]"); }