|
@@ -144,6 +144,7 @@ namespace WeChatCore
|
|
|
string XmlList = HttpMethods.Get(UrlDefine.LoginUrls, CommonDefine.Cookies, Encoding.UTF8, true).ContentData.ToString();
|
|
|
CommonDefine.GetCookieDictionary = HttpMethods.SetCookieDictionary;
|
|
|
CommonDefine.LoginResult = XMLHelper.DESerializer<LoginResultEntity>(XmlList);
|
|
|
+ //此处可用于二次点击登录
|
|
|
LogWriter.Write(CommonDefine.LoginResult.wxuin, Environment.CurrentDirectory + "\\Data\\data.dat");
|
|
|
Random r = new Random();
|
|
|
BaseRequestEntity Bre = new BaseRequestEntity() { Uin = CommonDefine.LoginResult.wxuin, Sid = CommonDefine.LoginResult.wxsid, Skey = CommonDefine.LoginResult.skey, DeviceID = MethodsHelper.GetDeviceId() };
|
|
@@ -505,7 +506,7 @@ namespace WeChatCore
|
|
|
|
|
|
#region 储存消息
|
|
|
|
|
|
- if (ali.MsgType == 34)
|
|
|
+ if (ali.MsgType == (int)MsgTypeEnum.Voice)
|
|
|
{
|
|
|
me.MsgType = MsgTypeEnum.Voice;
|
|
|
//语音消息
|
|
@@ -517,7 +518,7 @@ namespace WeChatCore
|
|
|
me.FileId = FileId;
|
|
|
me.FilePath = Environment.CurrentDirectory + "\\" + DirectoryDefine.VoiceMsgPath + "\\" + me.FileId + ".mp3";
|
|
|
}
|
|
|
- else if (ali.MsgType == 3)
|
|
|
+ else if (ali.MsgType == (int)MsgTypeEnum.Picture)
|
|
|
{
|
|
|
me.MsgType = MsgTypeEnum.Picture;
|
|
|
//图片消息
|
|
@@ -534,7 +535,7 @@ namespace WeChatCore
|
|
|
me.FilePath = Environment.CurrentDirectory + "\\" + DirectoryDefine.ImageMsgPath + "\\" + FileId + ".jpg";//
|
|
|
me.FileTempPath = Environment.CurrentDirectory + "\\" + DirectoryDefine.ImageMsgTempPath + "\\" + FileId + ".jpg";
|
|
|
}
|
|
|
- else if (ali.MsgType == 49)
|
|
|
+ else if (ali.MsgType == (int)MsgTypeEnum.Gif)
|
|
|
{
|
|
|
//TODO:GIF消息
|
|
|
me.MsgType = MsgTypeEnum.Gif;
|
|
@@ -548,7 +549,7 @@ namespace WeChatCore
|
|
|
me.FilePath = Environment.CurrentDirectory + "\\" + DirectoryDefine.ImageMsgGifPath + "\\" + FileId + ".gif";//
|
|
|
me.FileTempPath = Environment.CurrentDirectory + "\\" + DirectoryDefine.ImageMsgTempPath + "\\" + FileId + ".jpg";
|
|
|
}
|
|
|
- else if (ali.MsgType == 43)
|
|
|
+ else if (ali.MsgType == (int)MsgTypeEnum.Video)
|
|
|
{
|
|
|
me.MsgType = MsgTypeEnum.Video;
|
|
|
//视频消息
|
|
@@ -576,7 +577,7 @@ namespace WeChatCore
|
|
|
me.FilePath = Environment.CurrentDirectory + "\\" + DirectoryDefine.MapImageMsgPath + "\\" + FileId + ".jpg";
|
|
|
me.MsgTime = DateTime.Now;
|
|
|
}
|
|
|
- else if (ali.MsgType == 10000)
|
|
|
+ else if (ali.MsgType == (int)MsgTypeEnum.SystemMsg)
|
|
|
{
|
|
|
me.MsgType = MsgTypeEnum.SystemMsg;
|
|
|
me.MsgTime = DateTime.Now;
|
|
@@ -594,7 +595,7 @@ namespace WeChatCore
|
|
|
}
|
|
|
catch (Exception ex)
|
|
|
{
|
|
|
- Console.WriteLine(ex.Message);
|
|
|
+ LogWriter.Write(ex.Message, LogPathDefine.ExceptionLogPath);
|
|
|
}
|
|
|
|
|
|
}
|
|
@@ -763,17 +764,17 @@ namespace WeChatCore
|
|
|
Fe.BaseRequest = new BaseRequestEntity() { DeviceID = MethodsHelper.GetDeviceId(), Uin = CommonDefine.LoginResult.wxuin, Sid = CommonDefine.LoginResult.wxsid, Skey = CommonDefine.LoginResult.skey };
|
|
|
string Boundary = "------WebKitFormBoundaryUOlSZtOip6JP4NSr";
|
|
|
HttpMethods.AddContent("id", "WU_FILE_0", Boundary);
|
|
|
- HttpMethods.AddContent("name", Fe.FileName, Boundary);
|
|
|
- HttpMethods.AddContent("type", Fe.FileType, Boundary);
|
|
|
+ HttpMethods.AddContent("name", Fe.FileName, Boundary);
|
|
|
+ HttpMethods.AddContent("type", Fe.FileType, Boundary);
|
|
|
HttpMethods.AddContent("lastModifiedDate", Fe.FileModiftTime.ToLocalTime().ToString(), Boundary);
|
|
|
- HttpMethods.AddContent("size", Fe.DataLen.ToString(), Boundary);
|
|
|
- HttpMethods.AddContent("mediatype", Fe.Mediatype1, Boundary);
|
|
|
- HttpMethods.AddContent("uploadmediarequest", JsonConvert.SerializeObject(Fe), Boundary);
|
|
|
+ HttpMethods.AddContent("size", Fe.DataLen.ToString(), Boundary);
|
|
|
+ HttpMethods.AddContent("mediatype", Fe.Mediatype1, Boundary);
|
|
|
+ HttpMethods.AddContent("uploadmediarequest", JsonConvert.SerializeObject(Fe), Boundary);
|
|
|
HttpMethods.AddContent("webwx_data_ticket", CommonDefine.GetCookieDictionary == null ? "" : CommonDefine.GetCookieDictionary["webwx_data_ticket"], Boundary);//"gScOa2YvEEtszEvhoxdwXCeg"
|
|
|
- HttpMethods.AddContent("pass_ticket", CommonDefine.LoginResult.pass_ticket, Boundary);//"ekYYf2P7xOH5iI+oYrf/GiGrZhE+fUEGMiXe3Pq71rb4MDe+7ICbD+kglD4ZE+Ey"
|
|
|
- HttpMethods.AddContent("filename", Fe.FileName, Fe.FileType, FileData, Boundary);
|
|
|
- HttpMethods.OptionsDataMulitData(UrlDefine.SendFileUrl, CommonDefine.Cookies, Encoding.UTF8,Boundary);
|
|
|
- HttpMethods.PostDataMulitData(UrlDefine.SendFileUrl, CommonDefine.Cookies, Encoding.UTF8,Boundary);
|
|
|
+ HttpMethods.AddContent("pass_ticket", CommonDefine.LoginResult.pass_ticket, Boundary);//"ekYYf2P7xOH5iI+oYrf/GiGrZhE+fUEGMiXe3Pq71rb4MDe+7ICbD+kglD4ZE+Ey"
|
|
|
+ HttpMethods.AddContent("filename", Fe.FileName, Fe.FileType, FileData, Boundary);
|
|
|
+ HttpMethods.OptionsDataMulitData(UrlDefine.SendFileUrl, CommonDefine.Cookies, Encoding.UTF8, Boundary);
|
|
|
+ HttpMethods.PostDataMulitData(UrlDefine.SendFileUrl, CommonDefine.Cookies, Encoding.UTF8, Boundary);
|
|
|
}
|
|
|
#endregion
|
|
|
|