/// <summary>
        /// 通过CPU序列号和硬盘序列号的前24位做机器码
        /// </summary>
        /// <returns></returns>
        public string GetMachineNum()
        {
            string Num        = GetCpuSerialNum() + GetDiskSerialNum();
            string MachineNum = Md5Helper.CreateMD5(Num).Substring(0, 12).ToUpper();

            return(MachineNum);
        }
Exemple #2
0
        public bool GetFriendsDict(SQLiteConnection conn, SQLiteConnection wcdb, Friend myself, out Dictionary <string, Friend> friends, out int count)
        {
            count   = 0;
            friends = new Dictionary <string, Friend>();
            bool succ = GetFriends(conn, myself, out List <Friend> _friends);

            if (wcdb != null)
            {
                succ |= GetWCDBFriends(wcdb, out List <Friend> _friends2);
                _friends.AddRange(_friends2);
            }
            if (succ)
            {
                foreach (var friend in _friends)
                {
                    count++;
                    friends.AddSafe(friend.UsrName, friend);
                    friends.AddSafe(Md5Helper.CreateMD5(friend.UsrName), friend);
                    if (friend.alias != null && friend.alias != "" && !friends.ContainsKeySafe(friend.alias))
                    {
                        friends.AddSafe(friend.alias, friend);
                        friends.AddSafe(Md5Helper.CreateMD5(friend.alias), friend);
                    }
                }
            }
            return(succ);
        }
Exemple #3
0
 private string GetVoicePath(string imgPath)
 {
     if (!string.IsNullOrEmpty(imgPath))
     {
         string md5  = Md5Helper.CreateMD5(imgPath);
         string path = Path.Combine(resBaseDir, "voice2", md5.Substring(0, 2), md5.Substring(2, 2), string.Format("msg_{0}.amr", imgPath));
         if (File.Exists(path))
         {
             return(path);
         }
     }
     return(null);
 }
Exemple #4
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;
            }
        }
Exemple #5
0
        private void InitUserBaseDir()
        {
            string tmp = "mm" + uid;

            userBaseDir = Path.Combine(weChatInterface.currentBackup, "MicroMsg", Md5Helper.CreateMD5(tmp).ToLower());
        }
Exemple #6
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"));
        }
Exemple #7
0
        private string GetDBPassword(string imei)
        {
            string tmp = imei + uid;

            return(Md5Helper.CreateMD5(tmp).Substring(0, 7).ToLower());
        }
Exemple #8
0
        public string GetAndroidUserAvatar()
        {
            string md5 = Md5Helper.CreateMD5(UsrName);

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