瀏覽代碼

62数据转码

62数据转码
changtuiqie 7 年之前
父節點
當前提交
d91dadbba5

二進制
.vs/Ipad/v15/.suo


+ 2 - 2
IPADDemo/FormDemo.cs

@@ -263,7 +263,7 @@ namespace IPADDemo
         {
             string str= weChatThread.Wx_GenerateWxDat();
             WxDat wxDat = JsonConvert.DeserializeObject<WxDat>(str);
-            txt_login62.Text = wxDat.data;
+            txt_login62.Text = EUtils.EStrToHex( wxDat.data);
         }
 
         private void button18_Click(object sender, EventArgs e)
@@ -290,7 +290,7 @@ namespace IPADDemo
 
         private void button13_Click(object sender, EventArgs e)
         {
-            weChatThread = new XzyWeChatThread(txt_login62.Text,txt_loginName.Text,txt_loginPassword.Text);
+            weChatThread = new XzyWeChatThread(EUtils.EHexToStr(txt_login62.Text),txt_loginName.Text,txt_loginPassword.Text);
         }
 
         private void button15_Click(object sender, EventArgs e)

+ 1 - 0
IPADDemo/IPADDemo.csproj

@@ -152,6 +152,7 @@
     <Compile Include="Properties\AssemblyInfo.cs" />
     <Compile Include="Util\Base64.cs" />
     <Compile Include="Util\BaseClass.cs" />
+    <Compile Include="Util\EUtils.cs" />
     <Compile Include="Util\HttpUtil.cs" />
     <Compile Include="Util\MyUtils.cs" />
     <Compile Include="Util\ffmpegUtils.cs" />

+ 133 - 0
IPADDemo/Util/EUtils.cs

@@ -0,0 +1,133 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Runtime.InteropServices;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace IPADDemo.Util
+{
+    public static class EUtils
+    {
+        #region 易语言 Utils 处理中文乱码
+        /// <summary>
+        /// 发送文字朋友圈
+        /// </summary>
+        /// <param name="wxuser"></param>
+        /// <param name="str"></param>
+        /// <returns></returns>
+        [DllImport("EUtils.dll")]
+        public static extern int ESendSNS(int wxuser, string str);
+
+        /// <summary>
+        /// 发送朋友圈图片
+        /// </summary>
+        /// <param name="wxuser"></param>
+        /// <param name="xml"></param>
+        /// <param name="context"></param>
+        /// <returns></returns>
+        [DllImport("EUtils.dll")]
+        public static extern int ESendSNSImage(int wxuser, string xml, string context);
+
+        /// <summary>
+        /// 设置群公告
+        /// </summary>
+        /// <param name="wxuser"></param>
+        /// <param name="wxid"></param>
+        /// <param name="context"></param>
+        /// <returns></returns>
+        [DllImport("EUtils.dll")]
+        public static extern int ESetChatroomAnnouncement(int wxuser, string wxid, string context);
+
+        /// <summary>
+        /// 设置群名称
+        /// </summary>
+        /// <param name="wxuser"></param>
+        /// <param name="wxid"></param>
+        /// <param name="name"></param>
+        /// <returns></returns>
+        [DllImport("EUtils.dll")]
+        public static extern int ESetChatroomName(int wxuser, string wxid, string name);
+
+        /// <summary>
+        /// 发送名片
+        /// </summary>
+        /// <param name="wxuser"></param>
+        /// <param name="wxid"></param>
+        /// <param name="fromwxid"></param>
+        /// <param name="caption"></param>
+        /// <returns></returns>
+        [DllImport("EUtils.dll")]
+        public static extern int EShareCarde(int wxuser, string wxid, string fromwxid, string caption);
+
+        /// <summary>
+        /// 朋友圈评论
+        /// </summary>
+        /// <param name="wxuser"></param>
+        /// <param name="wxid"></param>
+        /// <param name="snsid"></param>
+        /// <param name="context"></param>
+        /// <param name="replyid"></param>
+        /// <returns></returns>
+        [DllImport("EUtils.dll")]
+        public static extern int ESnsComment(int wxuser, string wxid, string snsid, string context, int replyid);
+
+        /// <summary>
+        /// 添加用户
+        /// </summary>
+        /// <param name="wxuser"></param>
+        /// <param name="v1"></param>
+        /// <param name="v2"></param>
+        /// <param name="type"></param>
+        /// <param name="context"></param>
+        /// <returns></returns>
+        [DllImport("EUtils.dll")]
+        public static extern int EAddUser(int wxuser, string v1, string v2, int type, string context);
+
+        /// <summary>
+        /// 设置备注
+        /// </summary>
+        /// <param name="wxuser"></param>
+        /// <param name="wxid"></param>
+        /// <param name="context"></param>
+        /// <returns></returns>
+        [DllImport("EUtils.dll")]
+        public static extern int ESetUserRemark(int wxuser, string wxid, string context);
+
+        /// <summary>
+        /// 打招呼
+        /// </summary>
+        /// <param name="wxuser"></param>
+        /// <param name="v1"></param>
+        /// <param name="context"></param>
+        /// <returns></returns>
+        [DllImport("EUtils.dll")]
+        public static extern int ESayHello(int wxuser, string v1, string context);
+
+        /// <summary>
+        /// 添加标签
+        /// </summary>
+        /// <param name="wxuser"></param>
+        /// <param name="context"></param>
+        /// <returns></returns>
+        [DllImport("EUtils.dll")]
+        public static extern int EAddContactLabel(int wxuser, string context);
+
+        /// <summary>
+        /// 16进制转字符串
+        /// </summary>
+        /// <param name="context"></param>
+        /// <returns></returns>
+        [DllImport("EUtils.dll")]
+        public static extern string EStrToHex(string context);
+
+        /// <summary>
+        /// 字符串转16进制
+        /// </summary>
+        /// <param name="context"></param>
+        /// <returns></returns>
+        [DllImport("EUtils.dll")]
+        public static extern string EHexToStr(string context);
+        #endregion
+    }
+}

+ 8 - 39
IPADDemo/WeChat/XzyWeChatThread.cs

@@ -796,7 +796,7 @@ namespace IPADDemo.WeChat
             fixed (int* WxUser1 = &pointerWxUser, msgptr1 = &msgPtr)
             {
 
-                msgPtr = EShareCarde(pointerWxUser, user, wxid, title);
+                msgPtr = EUtils.EShareCarde(pointerWxUser, user, wxid, title);
                 var datas = MarshalNativeToManaged((IntPtr)msgPtr);
                 result = datas.ToString();
                 Wx_ReleaseEX(ref wx_imptr);
@@ -1222,7 +1222,7 @@ namespace IPADDemo.WeChat
             {
                 try
                 {
-                    msgPtr = ESetChatroomName(pointerWxUser, groupid, content);
+                    msgPtr = EUtils.ESetChatroomName(pointerWxUser, groupid, content);
                     var datas = MarshalNativeToManaged((IntPtr)msgPtr);
                     result = datas.ToString();
                     Wx_ReleaseEX(ref msgPtr);
@@ -1254,7 +1254,7 @@ namespace IPADDemo.WeChat
                     //Wx_ReleaseEX(ref msgPtr);
 
                     //方案二
-                    msgPtr = ESetChatroomAnnouncement(pointerWxUser, groupid, content);
+                    msgPtr = EUtils.ESetChatroomAnnouncement(pointerWxUser, groupid, content);
                     var datas = MarshalNativeToManaged((IntPtr)msgPtr);
                     result = datas.ToString();
                     Wx_ReleaseEX(ref msgPtr);
@@ -1348,7 +1348,7 @@ namespace IPADDemo.WeChat
             var result = "";
             fixed (int* WxUser1 = &pointerWxUser, msgptr1 = &msgPtr)
             {
-                msgPtr = ESnsComment(pointerWxUser, this.wxUser.wxid, snsid, content, replyid);
+                msgPtr = EUtils.ESnsComment(pointerWxUser, this.wxUser.wxid, snsid, content, replyid);
                 var datas = MarshalNativeToManaged((IntPtr)msgPtr);
                 result = datas.ToString();
                 Wx_ReleaseEX(ref msgPtr);
@@ -1459,7 +1459,7 @@ namespace IPADDemo.WeChat
                         imagestr += String.Format(App.PYQContentImage, upload.big_url, upload.small_url, upload.size, 100, 100);
                     }
                     var result = String.Format(App.PYQContent, wxUser.wxid, imagestr);
-                    msgPtr = ESendSNSImage(pointerWxUser, result, content);
+                    msgPtr = EUtils.ESendSNSImage(pointerWxUser, result, content);
                     var datas = MarshalNativeToManaged((IntPtr)msgPtr);
                     result = datas.ToString();
                     Wx_ReleaseEX(ref msgPtr);
@@ -1474,7 +1474,7 @@ namespace IPADDemo.WeChat
             var result = "";
             fixed (int* WxUser1 = &pointerWxUser, msgptr1 = &msgPtr)
             {
-                msgPtr = ESendSNS(pointerWxUser, content);
+                msgPtr = EUtils.ESendSNS(pointerWxUser, content);
                 var datas = MarshalNativeToManaged((IntPtr)msgPtr);
                 result = datas.ToString();
                 Wx_ReleaseEX(ref msgPtr);
@@ -1616,7 +1616,7 @@ namespace IPADDemo.WeChat
             var result = "";
             fixed (int* WxUser1 = &pointerWxUser, msgptr1 = &msgPtr)
             {
-                msgPtr = ESetUserRemark(pointerWxUser, wxid, context);
+                msgPtr = EUtils.ESetUserRemark(pointerWxUser, wxid, context);
                 var datas = MarshalNativeToManaged((IntPtr)msgPtr);
                 result = datas.ToString();
                 Wx_ReleaseEX(ref msgPtr);
@@ -1955,7 +1955,7 @@ namespace IPADDemo.WeChat
             var result = "";
             fixed (int* WxUser1 = &pointerWxUser, msgptr1 = &msgPtr)
             {
-                msgPtr = EAddContactLabel(pointerWxUser, context);
+                msgPtr = EUtils.EAddContactLabel(pointerWxUser, context);
                 var datas = MarshalNativeToManaged((IntPtr)msgPtr);
                 result = datas.ToString();
                 Wx_ReleaseEX(ref msgPtr);
@@ -2303,36 +2303,5 @@ namespace IPADDemo.WeChat
 
         #endregion
 
-        #region 易语言 Utils 处理中文乱码
-        [DllImport("EUtils.dll")]
-        public static extern int ESendSNS(int wxuser, string str);
-
-        [DllImport("EUtils.dll")]
-        public static extern int ESendSNSImage(int wxuser, string xml, string context);
-
-        [DllImport("EUtils.dll")]
-        public static extern int ESetChatroomAnnouncement(int wxuser, string wxid, string context);
-
-        [DllImport("EUtils.dll")]
-        public static extern int ESetChatroomName(int wxuser, string wxid, string name);
-
-        [DllImport("EUtils.dll")]
-        public static extern int EShareCarde(int wxuser, string wxid, string fromwxid, string caption);
-
-        [DllImport("EUtils.dll")]
-        public static extern int ESnsComment(int wxuser, string wxid, string snsid, string context,int replyid);
-
-        [DllImport("EUtils.dll")]
-        public static extern int EAddUser(int wxuser, string v1, string v2, int type,string context);
-
-        [DllImport("EUtils.dll")]
-        public static extern int ESetUserRemark(int wxuser, string wxid, string context);
-
-        [DllImport("EUtils.dll")]
-        public static extern int ESayHello(int wxuser, string v1, string context);
-
-        [DllImport("EUtils.dll")]
-        public static extern int EAddContactLabel(int wxuser, string context);
-        #endregion
     }
 }

二進制
IPADDemo/bin/Debug/EUtils.bak


二進制
IPADDemo/bin/Debug/EUtils.dll


二進制
IPADDemo/bin/Debug/IPADDemo.exe


二進制
IPADDemo/bin/Debug/IPADDemo.pdb


+ 1 - 1
IPADDemo/obj/Debug/IPADDemo.csproj.CoreCompileInputs.cache

@@ -1 +1 @@
-7e5a253e718c5ba6275e782e0f6168cf0a164c76
+b9b4daf35c1ed5440c11f15a7cc6f96720aa1f1a

二進制
IPADDemo/obj/Debug/IPADDemo.exe


二進制
IPADDemo/obj/Debug/IPADDemo.pdb