/// <summary> /// 获取好友列表 /// </summary> /// <param name="robotQQ"></param> /// <returns></returns> public string GetFriendList(long robotQQ) { try { string result = (FriendHandle.GetFriendList(pKey, ApiData, robotQQ))[0].Card; MessageBox.Show(result); } catch (Exception ex) { MessageBox.Show(ex.ToString()); } /* if (string.IsNullOrEmpty(result)) * { * return null; * } * MessageBox.Show(result); * using (BinaryReader reader = new BinaryReader(new MemoryStream(Convert.FromBase64String(result)))) * { * if (reader.Length() < 4) * { * return null; * } * * List<FriendInfo> friends = new List<FriendInfo>(); * for (int i = 0, len = reader.ReadInt32_Ex(); i < len; i++) * { * FriendInfo temp = new FriendInfo(); * if (reader.Length() <= 0) * { * return null; * } * * using (BinaryReader tempReader = new BinaryReader(new MemoryStream(reader.ReadToken_Ex()))) * { * if (tempReader.Length() < 12) * { * return null; * } * * temp.Id = tempReader.ReadInt64_Ex(); * temp.Nick = tempReader.ReadString_Ex(_defaultEncoding); * temp.Card = tempReader.ReadString_Ex(_defaultEncoding); * } * * friends.Add(temp); * } * return friends; * }*/ return("112"); }
/// <summary> /// 获取QQ昵称 /// </summary> /// <param name="robotQQ"></param> /// <param name="qqId"></param> /// <param name="Cache">是否优先使用缓存</param> /// <returns></returns> public string GetQQNick(long robotQQ, long qqId, bool Cache = false) { string nick = string.Empty; if (Cache) { nick = FriendHandle.GetQQNickCache(pKey, ApiData, qqId).Trim(); if (nick.Length < 1) { nick = string.Empty; } } if (nick == string.Empty) { nick = FriendHandle.GetQQNick(pKey, ApiData, robotQQ, qqId); } return(nick); }