示例#1
0
        private void InitResBaseDir()
        {
            resBaseDir = null;
            if (string.IsNullOrEmpty(weChatInterface.resourceBackup))
            {
                return;
            }
            bool   flag        = false;
            string accountPath = Path.Combine(userBaseDir, "account.bin");

            if (File.Exists(accountPath))
            {
                using (FileStream fileStream = new FileStream(accountPath, FileMode.Open, FileAccess.Read))
                    using (BinaryReader reader = new BinaryReader(fileStream))
                    {
                        byte[] accountBytes = reader.ReadBytes((int)fileStream.Length);
                        if (accountBytes.Length == 4096 || accountBytes.Length == 4112)
                        {
                            byte[] uidBytes = Encoding.ASCII.GetBytes(uid);
                            byte[] allBytes = new byte[4096 + uid.Length];
                            Buffer.BlockCopy(accountBytes, 0, allBytes, 0, 4096);
                            Buffer.BlockCopy(uidBytes, 0, allBytes, 4096, uidBytes.Length);
                            string uiPath   = Md5Helper.CreateMD5(allBytes);
                            string fullPath = Path.Combine(weChatInterface.resourceBackup, "MicroMsg", uiPath);
                            if (Directory.Exists(fullPath))
                            {
                                flag       = true;
                                resBaseDir = fullPath;
                            }
                        }
                    }
            }

            if (!flag)
            {
                string tmp      = "mm" + uid;
                string fullPath = Path.Combine(weChatInterface.resourceBackup, "MicroMsg", Md5Helper.CreateMD5(tmp).ToLower());
                if (Directory.Exists(fullPath))
                {
                    resBaseDir = fullPath;
                }
            }

            if (!string.IsNullOrEmpty(resBaseDir))
            {
                hasRes = true;
            }
        }
示例#2
0
        private void InitUserBaseDir()
        {
            string tmp = "mm" + uid;

            userBaseDir = Path.Combine(weChatInterface.currentBackup, "MicroMsg", Md5Helper.CreateMD5(tmp).ToLower());
        }
示例#3
0
        private string GetDBPassword(string imei)
        {
            string tmp = imei + uid;

            return(Md5Helper.CreateMD5(tmp).Substring(0, 7).ToLower());
        }
示例#4
0
        private string GetUserAvatar(string userName)
        {
            string md5 = Md5Helper.CreateMD5(userName);

            return(Path.Combine(md5.Substring(0, 2), md5.Substring(2, 2), "user_" + md5 + ".png"));
        }
示例#5
0
        public string GetAndroidUserAvatar()
        {
            string md5 = Md5Helper.CreateMD5(UsrName);

            return(Path.Combine(md5.Substring(0, 2), md5.Substring(2, 2), "user_" + md5 + ".png"));
        }