using Newtonsoft.Json; using System; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Linq; using System.Security.Cryptography; using System.Text; using System.Threading.Tasks; using System.Windows; using WechatBakTool.Helpers; using WechatBakTool.Model; using WechatBakTool.ViewModel; namespace WechatBakTool { public class WXWorkspace { private UserBakConfig UserBakConfig = new UserBakConfig(); public WXWorkspace(string path,string account = "") { string checkResult = Init(path, false, account); if (checkResult != "") new Exception(checkResult); } public WXWorkspace(UserBakConfig userBakConfig) { UserBakConfig = userBakConfig; } public void DecryptDB(string pid,int type,CreateWorkViewModel viewModel,string pwd = "") { if (UserBakConfig == null) { throw new Exception("没有工作区文件,无法解密"); } if (!UserBakConfig.Decrypt) { byte[]? key = null; viewModel.LabelStatus = "正在获取秘钥,需要1 - 10秒左右"; if(pwd == "") key = DecryptionHelper.GetWechatKey(pid, type, UserBakConfig.Account); else { key = new byte[pwd.Length / 2]; for(int i = 0;i