資源簡(jiǎn)介
微信PC版協(xié)議實(shí)現(xiàn),本人親自調(diào)試通過,不會(huì)出現(xiàn)1100的錯(cuò)誤,值得你做二次開發(fā):
1.獲取服務(wù)器分配的一個(gè)唯一會(huì)話ID
2.通過會(huì)話ID獲得隨機(jī)登錄二維碼
3.輪詢手機(jī)端是否已經(jīng)掃描二維碼并確認(rèn)
4.訪問登錄地址,獲得uin和sid
5.初始化微信信息獲得當(dāng)前用戶的信息
6.獲得所有的好友列表
7.保持與服務(wù)器的信息同步
8.獲得別人發(fā)來的消息
9.向用戶發(fā)送消息
代碼片段和文件信息
using?System;
using?System.Collections.Generic;
using?System.ComponentModel;
using?System.Data;
using?System.Drawing;
using?System.Text;
using?System.Windows.Forms;
using?System.Drawing.Drawing2D;
using?WeChat.NET.HTTP;
using?System.Net;
using?System.Linq;
using?Newtonsoft.Json.Linq;
namespace?WeChat.NET
{
????///?
????///?微信登錄窗體
????///?
????public?partial?class?frmLogin?:?Form
????{
????????public?frmLogin()
????????{
????????????InitializeComponent();
????????}
????????///?
????????///?關(guān)閉按鈕
????????///?
????????///?
????????///?
????????private?void?picClose_Click(object?sender?EventArgs?e)
????????{
????????????Close();
????????}
????????///?
????????///?窗體加載
????????///?
????????///?
????????///?
????????private?void?frmLogin_Load(object?sender?EventArgs?e)
????????{
????????????DoLogin();
????????}
????????///?
????????///?返回二維碼界面?重新加載二維碼
????????///?
????????///?
????????///?
????????private?void?linkReturn_linkClicked(object?sender?linkLabellinkClickedEventArgs?e)
????????{
????????????linkReturn.Visible?=?false;
????????????DoLogin();
????????}
????????///?
????????///?登錄相關(guān)邏輯
????????///?
????????private?void?DoLogin()
????????{
????????????picQRCode.Image?=?null;
????????????picQRCode.SizeMode?=?PictureBoxSizeMode.Zoom;
????????????lblTip.Text?=?“手機(jī)微信掃一掃以登錄“;
????????????((Action)(delegate()
????????????{
????????????????//異步加載二維碼
????????????????LoginService?ls?=?new?LoginService();
????????????????Image?qrcode?=?ls.GetQRCode();
????????????????if?(qrcode?!=?null)
????????????????{
????????????????????this.BeginInvoke((Action)delegate()
????????????????????{
????????????????????????picQRCode.Image?=?qrcode;
????????????????????});
????????????????????object?login_result?=?null;
????????????????????while?(true)??//循環(huán)判斷手機(jī)掃面二維碼結(jié)果
????????????????????{
????????????????????????login_result?=?ls.LoginCheck();
????????????????????????if?(login_result?is?Image)?//已掃描?未登錄
????????????????????????{
????????????????????????????this.BeginInvoke((Action)delegate()
????????????????????????????{
????????????????????????????????lblTip.Text?=?“請(qǐng)點(diǎn)擊手機(jī)上登錄按鈕“;
????????????????????????????????picQRCode.SizeMode?=?PictureBoxSizeMode.CenterImage;??//顯示頭像
????????????????????????????????picQRCode.Image?=?login_result?as?Image;
????????????????????????????????linkReturn.Visible?=?true;
????????????????????????????});
????????????????????????}
????????????????????????if?(login_result?is?string)??//已完成登錄
????????????????????????{
????????????????????????????//訪問登錄跳轉(zhuǎn)URL
????????????????????????????ls.GetSidUid(login_result?as?string);
??????????????????????????//??WXService?wxs?=?new?WXService();
???????????????????????????//?Jobject?init_result?=?wxs.WxInit();
????????????????????????????//打開主界面
??????
?屬性????????????大小?????日期????時(shí)間???名稱
-----------?---------??----------?-----??----
????.......???????378??2015-10-30?17:59??WeChat.NET-master\WeChat.NET-master\.gitattributes
????.......???????574??2015-10-30?17:59??WeChat.NET-master\WeChat.NET-master\.gitignore
????..A..H.?????89600??2017-11-07?15:39??WeChat.NET-master\WeChat.NET-master\.vs\WeChat.NET\v14\.suo
????.......????146814??2015-10-30?17:59??WeChat.NET-master\WeChat.NET-master\assert\9.png
????.......???????745??2015-10-30?17:59??WeChat.NET-master\WeChat.NET-master\assert\back.png
????.......???????373??2015-10-30?17:59??WeChat.NET-master\WeChat.NET-master\assert\female.png
????.......???????713??2015-10-30?17:59??WeChat.NET-master\WeChat.NET-master\assert\info.png
????.......???????365??2015-10-30?17:59??WeChat.NET-master\WeChat.NET-master\assert\male.png
????.......?????17712??2015-10-30?17:59??WeChat.NET-master\WeChat.NET-master\assert\p1.png
????.......?????23839??2015-10-30?17:59??WeChat.NET-master\WeChat.NET-master\assert\p2.png
????.......?????29857??2015-10-30?17:59??WeChat.NET-master\WeChat.NET-master\assert\p3.png
????.......?????30808??2015-10-30?17:59??WeChat.NET-master\WeChat.NET-master\assert\p4.png
????.......?????22813??2015-10-30?17:59??WeChat.NET-master\WeChat.NET-master\assert\p5.png
????.......?????22793??2015-10-30?17:59??WeChat.NET-master\WeChat.NET-master\assert\p6.png
????.......?????40760??2015-10-30?17:59??WeChat.NET-master\WeChat.NET-master\assert\p7.png
????.......????148754??2015-10-30?17:59??WeChat.NET-master\WeChat.NET-master\assert\splash.jpg
????.......??????1474??2015-10-30?17:59??WeChat.NET-master\WeChat.NET-master\README.MD
????.......???????141??2015-10-30?17:59??WeChat.NET-master\WeChat.NET-master\WeChat.NET\app.config
????.......????862208??2015-10-30?17:59??WeChat.NET-master\WeChat.NET-master\WeChat.NET\bin\Debug\CFLite.dll
????.......??13911552??2015-10-30?17:59??WeChat.NET-master\WeChat.NET-master\WeChat.NET\bin\Debug\icudt40.dll
????.......???1245184??2015-10-30?17:59??WeChat.NET-master\WeChat.NET-master\WeChat.NET\bin\Debug\icuin40.dll
????.......???1079296??2015-10-30?17:59??WeChat.NET-master\WeChat.NET-master\WeChat.NET\bin\Debug\icuuc40.dll
????.......???1059328??2015-10-30?17:59??WeChat.NET-master\WeChat.NET-master\WeChat.NET\bin\Debug\ja
????.......????225280??2015-10-30?17:59??WeChat.NET-master\WeChat.NET-master\WeChat.NET\bin\Debug\libcurl.dll
????.......???1017344??2015-10-30?17:59??WeChat.NET-master\WeChat.NET-master\WeChat.NET\bin\Debug\libeay32.dll
????.......?????61952??2015-10-30?17:59??WeChat.NET-master\WeChat.NET-master\WeChat.NET\bin\Debug\libexslt.dll
????.......???1919488??2015-10-30?17:59??WeChat.NET-master\WeChat.NET-master\WeChat.NET\bin\Debug\libxm
????.......????170496??2015-10-30?17:59??WeChat.NET-master\WeChat.NET-master\WeChat.NET\bin\Debug\libxslt.dll
?????文件?????510976??2015-10-30?17:59??WeChat.NET-master\WeChat.NET-master\WeChat.NET\bin\Debug\Newtonsoft.Json.dll
????.......????121344??2015-10-30?17:59??WeChat.NET-master\WeChat.NET-master\WeChat.NET\bin\Debug\objc.dll
............此處省略107個(gè)文件信息
評(píng)論
共有 條評(píng)論