|
@@ -1,5 +1,7 @@
|
|
|
using System;
|
|
|
using System.Collections.Generic;
|
|
|
+using System.Diagnostics;
|
|
|
+using System.IO;
|
|
|
using System.Linq;
|
|
|
using System.Text;
|
|
|
using System.Threading.Tasks;
|
|
@@ -12,6 +14,9 @@ using System.Windows.Media;
|
|
|
using System.Windows.Media.Imaging;
|
|
|
using System.Windows.Navigation;
|
|
|
using System.Windows.Shapes;
|
|
|
+using WechatPCMsgBakTool.Helpers;
|
|
|
+using WechatPCMsgBakTool.Model;
|
|
|
+using WechatPCMsgBakTool.ViewModel;
|
|
|
|
|
|
namespace WechatPCMsgBakTool.Pages
|
|
|
{
|
|
@@ -20,9 +25,80 @@ namespace WechatPCMsgBakTool.Pages
|
|
|
|
|
|
public partial class CreateWork : Page
|
|
|
{
|
|
|
+ private CreateWorkViewModel ViewModel = new CreateWorkViewModel();
|
|
|
public CreateWork()
|
|
|
{
|
|
|
+ DataContext = ViewModel;
|
|
|
InitializeComponent();
|
|
|
+ GetWechatProcessInfos();
|
|
|
+ }
|
|
|
+
|
|
|
+ private void GetWechatProcessInfos()
|
|
|
+ {
|
|
|
+ ViewModel.ProcessInfos.Clear();
|
|
|
+ Process[] processes = Process.GetProcessesByName("wechat");
|
|
|
+ foreach (Process p in processes)
|
|
|
+ {
|
|
|
+ var lHandles = NativeAPIHelper.GetHandleInfoForPID((uint)p.Id);
|
|
|
+ foreach (var h in lHandles)
|
|
|
+ {
|
|
|
+ string name = NativeAPIHelper.FindHandleName(h, p);
|
|
|
+ if (name != "")
|
|
|
+ {
|
|
|
+
|
|
|
+ if (File.Exists("handle.log"))
|
|
|
+ {
|
|
|
+ File.AppendAllText("handle.log", string.Format("{0}|{1}|{2}|{3}\n", p.Id, h.ObjectTypeIndex, h.HandleValue, name));
|
|
|
+ }
|
|
|
+ if (name.Contains("\\MicroMsg.db") && name.Substring(name.Length - 3, 3) == ".db")
|
|
|
+ {
|
|
|
+ ProcessInfo info = new ProcessInfo();
|
|
|
+ info.ProcessId = p.Id.ToString();
|
|
|
+ info.ProcessName = p.ProcessName;
|
|
|
+ info.DBPath = DevicePathMapper.FromDevicePath(name);
|
|
|
+ ViewModel.ProcessInfos.Add(info);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ private void list_process_SelectionChanged(object sender, SelectionChangedEventArgs e)
|
|
|
+ {
|
|
|
+ if (ViewModel.SelectProcess != null)
|
|
|
+ {
|
|
|
+ string[] name_raw = ViewModel.SelectProcess.DBPath.Split("\\");
|
|
|
+ ViewModel.UserName = name_raw[name_raw.Length - 3];
|
|
|
+
|
|
|
+ FileInfo fileInfo = new FileInfo(ViewModel.SelectProcess.DBPath);
|
|
|
+ DirectoryInfo msgParent = fileInfo.Directory!.Parent!;
|
|
|
+ DirectoryInfo[] accounts = msgParent.GetDirectories();
|
|
|
+
|
|
|
+ DirectoryInfo? newUserName = null;
|
|
|
+ foreach ( DirectoryInfo account in accounts )
|
|
|
+ {
|
|
|
+ if(account.Name.Contains("account_")) {
|
|
|
+ if(newUserName == null)
|
|
|
+ newUserName = account;
|
|
|
+ else
|
|
|
+ {
|
|
|
+ if (newUserName.LastWriteTime < account.LastWriteTime)
|
|
|
+ newUserName = account;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if(newUserName != null)
|
|
|
+ {
|
|
|
+ ViewModel.UserName = newUserName.Name.Split("_")[1];
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ private void btn_create_worksapce_Click(object sender, RoutedEventArgs e)
|
|
|
+ {
|
|
|
+
|
|
|
}
|
|
|
}
|
|
|
}
|