changtuiqie 7 年之前
父节点
当前提交
918152e307

+ 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\Cover.cs" />
     <Compile Include="Util\EUtils.cs" />
     <Compile Include="Util\HttpUtil.cs" />
     <Compile Include="Util\MyUtils.cs" />

+ 9 - 0
IPADDemo/Util/BaseClass.cs

@@ -199,5 +199,14 @@ namespace IPADDemo.Util
             Image image = Image.FromStream(ms);
             return image;
         }
+
+        /// <summary>
+        /// utf8转ansi
+        /// </summary>
+        /// <param name="str"></param>
+        /// <returns></returns>
+        public static string Utf8ToAnsi(this string str) {
+           return Cover.MByteToWChar(str, 936);
+        }
     }
 }

+ 32 - 0
IPADDemo/Util/Cover.cs

@@ -0,0 +1,32 @@
+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 Cover
+    {
+        [DllImport("kernel32.dll")]
+        public static extern int MultiByteToWideChar(int CodePage, int dwFlags, string lpMultiByteStr, int cchMultiByte, [MarshalAs(UnmanagedType.LPWStr)]string lpWideCharStr, int cchWideChar);
+
+        /// <summary>
+        /// 宽字符集转换
+        /// </summary>
+        /// <param name="content"></param>
+        /// <param name="toEncode"></param>
+        /// <returns></returns>
+        public static string MByteToWChar(string content, int toEncode)
+        {
+            //字符编码转换 GB2312:936   UTF-8:65001  BIG5:950  latin1:1252
+            int len = Cover.MultiByteToWideChar(toEncode, 0, content, -1, null, 0);
+            char[] temp = new char[len];
+            string content1 = new string(temp);
+            Cover.MultiByteToWideChar(toEncode, 0, content, -1, content1, len);
+            return content1.Replace("\0", "");
+        }
+
+    }
+}

+ 5 - 3
IPADDemo/WeChat/XzyWeChatThread.cs

@@ -1561,10 +1561,12 @@ namespace IPADDemo.WeChat
                         }
                         else if (c.UserName.IndexOf("gh_") != -1) {
                             WxDelegate.getGZH(c);
-                        }
-                            
+                        }    
+                    }
+                    if (con == 0) {
+
+                        break;
                     }
-                    if (con == 0) { break; }
                 }
                 XzyWxApis.WXSyncReset(pointerWxUser);
             }

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


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


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

@@ -1 +1 @@
-b9b4daf35c1ed5440c11f15a7cc6f96720aa1f1a
+271dd2a058acdccc155c8bf7295da1f6feda920d

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


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


二进制
dll/EUtils.bak


二进制
dll/EUtils.dll