/// <summary> /// 获取微信头像 /// </summary> /// <param name="username"></param> /// <returns></returns> public async Task <string> GetHeadImgBase64Async(string username) { if (username.Contains("@@")) //讨论组 { byte[] bytes = await Service.DownloadBytesAsync(_getheadimg_url + username); return(Convert.ToBase64String(bytes)); } else { byte[] bytes = await Service.DownloadBytesAsync(_geticon_url + username); return(Convert.ToBase64String(bytes)); } }
/// <summary> /// 获取登录二维码 /// 网页版微信登录第一步 /// </summary> /// <returns></returns> public async Task <Image> GetQRCodeAsync() { byte[] bytes = await Service.DownloadBytesAsync(_session_id_url); _session_id = Encoding.UTF8.GetString(bytes).Split(new string[] { "\"" }, StringSplitOptions.None)[1]; bytes = await Service.DownloadBytesAsync(_qrcode_url + _session_id); return(Image.FromStream(new MemoryStream(bytes))); }