Compare commits
4 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
c66a539d48 | ||
|
|
51da1fd0ae | ||
|
|
4213395c9f | ||
|
|
b43a517322 |
@@ -13,6 +13,7 @@ using WechatBakTool.ViewModel;
|
||||
using System.Security.Policy;
|
||||
using System.Windows;
|
||||
using System.Xml.Linq;
|
||||
using WechatBakTool.Helpers;
|
||||
|
||||
namespace WechatBakTool.Export
|
||||
{
|
||||
@@ -144,7 +145,7 @@ namespace WechatBakTool.Export
|
||||
string xml = Encoding.UTF8.GetString(data);
|
||||
if (!string.IsNullOrEmpty(xml))
|
||||
{
|
||||
xml = xml.Replace("\n", "");
|
||||
xml = StringHelper.CleanInvalidXmlChars(xml);
|
||||
XmlDocument xmlObj = new XmlDocument();
|
||||
xmlObj.LoadXml(xml);
|
||||
if (xmlObj.DocumentElement != null)
|
||||
@@ -211,7 +212,7 @@ namespace WechatBakTool.Export
|
||||
string xml = Encoding.UTF8.GetString(data);
|
||||
if (!string.IsNullOrEmpty(xml))
|
||||
{
|
||||
xml = xml.Replace("\n", "");
|
||||
xml = StringHelper.CleanInvalidXmlChars(xml);
|
||||
XmlDocument xmlObj = new XmlDocument();
|
||||
xmlObj.LoadXml(xml);
|
||||
if (xmlObj.DocumentElement != null)
|
||||
@@ -263,7 +264,7 @@ namespace WechatBakTool.Export
|
||||
string xml = Encoding.UTF8.GetString(data);
|
||||
if (!string.IsNullOrEmpty(xml))
|
||||
{
|
||||
xml = xml.Replace("\n", "");
|
||||
xml = StringHelper.CleanInvalidXmlChars(xml);
|
||||
XmlDocument xmlObj = new XmlDocument();
|
||||
xmlObj.LoadXml(xml);
|
||||
if (xmlObj.DocumentElement != null)
|
||||
|
||||
@@ -13,18 +13,18 @@ namespace WechatBakTool.Helpers
|
||||
[DllImport("Kernel32.dll", CharSet = CharSet.Unicode)]
|
||||
private static extern uint QueryDosDevice([In] string lpDeviceName, [Out] StringBuilder lpTargetPath, [In] int ucchMax);
|
||||
|
||||
public static string FromDevicePath(string devicePath)
|
||||
public static string? FromDevicePath(string devicePath)
|
||||
{
|
||||
var drive = Array.Find(
|
||||
DriveInfo.GetDrives(), d =>
|
||||
devicePath.StartsWith(d.GetDevicePath() + "\\", StringComparison.InvariantCultureIgnoreCase)
|
||||
);
|
||||
return drive != null ?
|
||||
devicePath.ReplaceFirst(drive.GetDevicePath(), drive.GetDriveLetter()) :
|
||||
devicePath.ReplaceFirst(drive.GetDevicePath()!, drive.GetDriveLetter()) :
|
||||
null;
|
||||
}
|
||||
|
||||
private static string GetDevicePath(this DriveInfo driveInfo)
|
||||
private static string? GetDevicePath(this DriveInfo driveInfo)
|
||||
{
|
||||
var devicePathBuilder = new StringBuilder(128);
|
||||
return QueryDosDevice(driveInfo.GetDriveLetter(), devicePathBuilder, devicePathBuilder.Capacity + 1) != 0 ?
|
||||
|
||||
46
Helpers/StringHelper.cs
Normal file
46
Helpers/StringHelper.cs
Normal file
@@ -0,0 +1,46 @@
|
||||
using System.IO;
|
||||
using System.Text;
|
||||
using System.Text.RegularExpressions;
|
||||
|
||||
namespace WechatBakTool.Helpers
|
||||
{
|
||||
public static class StringHelper
|
||||
{
|
||||
/// <summary>
|
||||
/// 清理XML中的非法字符
|
||||
/// </summary>
|
||||
/// <param name="input">需要清理的字符串</param>
|
||||
/// <returns>清理后的字符串</returns>
|
||||
public static string CleanInvalidXmlChars(string input)
|
||||
{
|
||||
if (string.IsNullOrEmpty(input))
|
||||
return input;
|
||||
|
||||
// #x9 | #xA | #xD | [#x20-#xD7FF] | [#xE000-#xFFFD] | [#x10000-#x10FFFF]
|
||||
// 这里使用正则表达式匹配非法字符并替换
|
||||
return Regex.Replace(input, @"[^\u0009\u000A\u000D\u0020-\uD7FF\uE000-\uFFFD]", "");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 替换文件名中的非法字符为指定字符
|
||||
/// </summary>
|
||||
/// <param name="fileName">原始文件名</param>
|
||||
/// <param name="replacement">用于替换非法字符的字符,默认为 "-"</param>
|
||||
/// <returns>清理后的文件名</returns>
|
||||
public static string SanitizeFileName(string fileName, char replacement = '-')
|
||||
{
|
||||
if (string.IsNullOrEmpty(fileName))
|
||||
return fileName;
|
||||
|
||||
// 处理Windows系统中文件名不允许的特殊字符
|
||||
char[] invalidFileNameChars = Path.GetInvalidFileNameChars();
|
||||
|
||||
foreach (char invalidChar in invalidFileNameChars)
|
||||
{
|
||||
fileName = fileName.Replace(invalidChar, '-');
|
||||
}
|
||||
|
||||
return fileName;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -84,8 +84,6 @@ namespace WechatBakTool.Model
|
||||
public string Content { get; set; } = "";
|
||||
[Column("nTime")]
|
||||
public int LastTime { get; set; }
|
||||
public int ReadCount { get; set; }
|
||||
public int LastMsgId { get; set; }
|
||||
}
|
||||
|
||||
[Table("SessionAttachInfo")]
|
||||
|
||||
7
NuGet.config
Normal file
7
NuGet.config
Normal file
@@ -0,0 +1,7 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<configuration>
|
||||
<packageSources>
|
||||
<clear />
|
||||
<add key="nuget.org" value="https://api.nuget.org/v3/index.json" />
|
||||
</packageSources>
|
||||
</configuration>
|
||||
@@ -26,9 +26,9 @@
|
||||
<TextBox IsEnabled="{Binding IsEnable}" x:Name="txt_username" Margin="35,300,0,0" Width="280" HorizontalAlignment="Left" VerticalAlignment="Top" BorderThickness="0,0,0,1" Text="{Binding UserName}" />
|
||||
|
||||
<Label Margin="30,350,0,0" Content="请选择解密方式:" FontWeight="Bold" HorizontalAlignment="Left" VerticalAlignment="Top"/>
|
||||
<RadioButton Margin="35,380,0,0" Content="固定地址查找【保底】" HorizontalAlignment="Left" VerticalAlignment="Top" GroupName="rb_find_key" HorizontalContentAlignment="Center" IsEnabled="{Binding IsEnable}" VerticalContentAlignment="Center" IsChecked="{Binding KeyType, Converter={StaticResource ResourceKey=getKeyConverterKey}, ConverterParameter=1}" />
|
||||
<RadioButton Margin="35,380,0,0" Content="固定地址查找【推荐】" HorizontalAlignment="Left" VerticalAlignment="Top" GroupName="rb_find_key" HorizontalContentAlignment="Center" IsEnabled="{Binding IsEnable}" VerticalContentAlignment="Center" IsChecked="{Binding KeyType, Converter={StaticResource ResourceKey=getKeyConverterKey}, ConverterParameter=1}" />
|
||||
<RadioButton Margin="35,405,0,0" Content="用户名推断查找【不稳定】" HorizontalAlignment="Left" VerticalAlignment="Top" GroupName="rb_find_key" HorizontalContentAlignment="Center" IsEnabled="{Binding IsEnable}" VerticalContentAlignment="Center" IsChecked="{Binding KeyType, Converter={StaticResource ResourceKey=getKeyConverterKey}, ConverterParameter=2}"/>
|
||||
<RadioButton Margin="35,430,0,0" Content="公钥头推断查找【推荐】" HorizontalAlignment="Left" VerticalAlignment="Top" GroupName="rb_find_key" HorizontalContentAlignment="Center" IsEnabled="{Binding IsEnable}" VerticalContentAlignment="Center" IsChecked="{Binding KeyType, Converter={StaticResource ResourceKey=getKeyConverterKey}, ConverterParameter=3}"/>
|
||||
<RadioButton Margin="35,430,0,0" Content="公钥头推断查找【不稳定】" HorizontalAlignment="Left" VerticalAlignment="Top" GroupName="rb_find_key" HorizontalContentAlignment="Center" IsEnabled="{Binding IsEnable}" VerticalContentAlignment="Center" IsChecked="{Binding KeyType, Converter={StaticResource ResourceKey=getKeyConverterKey}, ConverterParameter=3}"/>
|
||||
|
||||
<Button Name="btn_create_worksapce" Margin="0,0,35,50" Height="60" Width="100" HorizontalAlignment="Right" VerticalAlignment="Bottom" Content="创建工作区" BorderThickness="0" IsEnabled="{Binding IsEnable}" Background="#2775b6" Foreground="White" Click="btn_create_worksapce_Click">
|
||||
<Button.Resources>
|
||||
|
||||
@@ -66,7 +66,7 @@ namespace WechatBakTool.Pages
|
||||
ProcessInfo info = new ProcessInfo();
|
||||
info.ProcessId = p.Id.ToString();
|
||||
info.ProcessName = p.ProcessName;
|
||||
info.DBPath = DevicePathMapper.FromDevicePath(name);
|
||||
info.DBPath = DevicePathMapper.FromDevicePath(name)!;
|
||||
ViewModel.ProcessInfos.Add(info);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -18,7 +18,9 @@ using System.Windows.Media;
|
||||
using System.Windows.Media.Imaging;
|
||||
using System.Windows.Navigation;
|
||||
using System.Xml;
|
||||
using WechatBakTool.Dialog;
|
||||
using WechatBakTool.Export;
|
||||
using WechatBakTool.Helpers;
|
||||
using WechatBakTool.Model;
|
||||
using WechatBakTool.ViewModel;
|
||||
|
||||
@@ -52,6 +54,17 @@ namespace WechatBakTool.Pages
|
||||
|
||||
private void btn_export_all_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
DatetimePickerViewModel datePickViewModel = new DatetimePickerViewModel();
|
||||
if (Status == 0)
|
||||
{
|
||||
MsgDatetimePicker picker = new MsgDatetimePicker(datePickViewModel);
|
||||
datePickViewModel.DateType = 1;
|
||||
datePickViewModel.PickDate = DateTime.Now.AddDays(-1);
|
||||
if (picker.ShowDialog() != true)
|
||||
{
|
||||
return;
|
||||
}
|
||||
}
|
||||
// 0 未开始
|
||||
if(Status == 0 || Status == 2)
|
||||
{
|
||||
@@ -103,12 +116,12 @@ namespace WechatBakTool.Pages
|
||||
if (group && contact.UserName.Contains("@chatroom"))
|
||||
{
|
||||
workspaceViewModel.WXContact = contact;
|
||||
ExportMsg(contact);
|
||||
ExportMsg(contact, datePickViewModel);
|
||||
}
|
||||
if (user && !contact.UserName.Contains("@chatroom") && !contact.UserName.Contains("gh_"))
|
||||
{
|
||||
workspaceViewModel.WXContact = contact;
|
||||
ExportMsg(contact);
|
||||
ExportMsg(contact, datePickViewModel);
|
||||
}
|
||||
process.Add(contact);
|
||||
}
|
||||
@@ -119,26 +132,22 @@ namespace WechatBakTool.Pages
|
||||
});
|
||||
}
|
||||
|
||||
private void ExportMsg(WXContact contact)
|
||||
private void ExportMsg(WXContact contact, DatetimePickerViewModel dt)
|
||||
{
|
||||
workspaceViewModel.ExportCount = "";
|
||||
// string path = Path.Combine(Main2.CurrentUserBakConfig!.UserWorkspacePath, contact.UserName + ".html");
|
||||
string name = contact.NickName;
|
||||
name = name.Replace(@"\", "");
|
||||
name = Regex.Replace(name, "[ \\[ \\] \\^ \\-_*×――(^)$%~!/@#$…&%¥—+=<>《》|!!???::•`·、。,;,.;\"‘’“”-]", "");
|
||||
string fileName = StringHelper.SanitizeFileName(string.Format(
|
||||
"{0}-{1}.html",
|
||||
contact.UserName,
|
||||
contact.Remark == "" ? contact.NickName : contact.Remark
|
||||
));
|
||||
string path = Path.Combine(
|
||||
Main2.CurrentUserBakConfig!.UserWorkspacePath,
|
||||
string.Format(
|
||||
"{0}-{1}.html",
|
||||
contact.UserName,
|
||||
contact.Remark == "" ? name : contact.Remark
|
||||
)
|
||||
fileName
|
||||
);
|
||||
|
||||
IExport export = new HtmlExport();
|
||||
export.InitTemplate(contact, path);
|
||||
DatetimePickerViewModel dt = new DatetimePickerViewModel();
|
||||
dt.DateType = 1;
|
||||
if (export.SetMsg(UserReader!, contact, workspaceViewModel, dt))
|
||||
{
|
||||
export.SetEnd();
|
||||
|
||||
@@ -270,16 +270,14 @@ namespace WechatBakTool.Pages
|
||||
return;
|
||||
}
|
||||
|
||||
string name = ViewModel.WXContact.NickName;
|
||||
name = name.Replace(@"\", "");
|
||||
name = Regex.Replace(name, "[ \\[ \\] \\^ \\-_*×――(^)$%~!/@#$…&%¥—+=<>《》|!!???::•`·、。,;,.;\"‘’“”-]", "");
|
||||
string fileName = StringHelper.SanitizeFileName(string.Format(
|
||||
"{0}-{1}",
|
||||
ViewModel.WXContact.UserName,
|
||||
ViewModel.WXContact.Remark == "" ? ViewModel.WXContact.NickName : ViewModel.WXContact.Remark
|
||||
));
|
||||
string path = Path.Combine(
|
||||
Main2.CurrentUserBakConfig!.UserWorkspacePath,
|
||||
string.Format(
|
||||
"{0}-{1}",
|
||||
ViewModel.WXContact.UserName,
|
||||
ViewModel.WXContact.Remark == "" ? name : ViewModel.WXContact.Remark
|
||||
)
|
||||
fileName
|
||||
);
|
||||
IExport export;
|
||||
|
||||
|
||||
@@ -52,6 +52,10 @@ namespace WechatBakTool
|
||||
continue;
|
||||
SQLiteConnection con = new SQLiteConnection(item);
|
||||
string dbName = fileInfo.Name.Split('.')[0];
|
||||
if (DBInfo.ContainsKey(dbName))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
DBInfo.Add(dbName, con);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,9 +6,9 @@
|
||||
<Nullable>enable</Nullable>
|
||||
<UseWPF>true</UseWPF>
|
||||
<AllowUnsafeBlocks>True</AllowUnsafeBlocks>
|
||||
<AssemblyVersion>0.9.7.3</AssemblyVersion>
|
||||
<FileVersion>0.9.7.3</FileVersion>
|
||||
<Version>0.9.7.3</Version>
|
||||
<AssemblyVersion>0.9.7.7</AssemblyVersion>
|
||||
<FileVersion>0.9.7.7</FileVersion>
|
||||
<Version>0.9.7.7</Version>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
||||
79
version.json
79
version.json
@@ -2,26 +2,77 @@
|
||||
{
|
||||
"Version": "3.9.6.33",
|
||||
"BaseAddr": 62031872
|
||||
},{
|
||||
"Version":"3.9.7.25",
|
||||
},
|
||||
{
|
||||
"Version": "3.9.7.25",
|
||||
"BaseAddr": 63484032
|
||||
},{
|
||||
"Version":"3.9.7.29",
|
||||
},
|
||||
{
|
||||
"Version": "3.9.7.29",
|
||||
"BaseAddr": 63488256
|
||||
},{
|
||||
"Version":"3.9.8.15",
|
||||
},
|
||||
{
|
||||
"Version": "3.9.8.15",
|
||||
"BaseAddr": 64997904
|
||||
},{
|
||||
"Version":"3.9.8.25",
|
||||
},
|
||||
{
|
||||
"Version": "3.9.8.25",
|
||||
"BaseAddr": 65002192
|
||||
},{
|
||||
"Version":"3.9.9.27",
|
||||
},
|
||||
{
|
||||
"Version": "3.9.9.27",
|
||||
"BaseAddr": 68066576
|
||||
},{
|
||||
"Version":"3.9.9.35",
|
||||
},
|
||||
{
|
||||
"Version": "3.9.9.35",
|
||||
"BaseAddr": 68066576
|
||||
},{
|
||||
"Version":"3.9.9.43",
|
||||
},
|
||||
{
|
||||
"Version": "3.9.9.43",
|
||||
"BaseAddr": 68067216
|
||||
},
|
||||
{
|
||||
"Version": "3.9.10.19",
|
||||
"BaseAddr": 95131040
|
||||
},
|
||||
{
|
||||
"Version": "3.9.10.27",
|
||||
"BaseAddr": 95126928
|
||||
},
|
||||
{
|
||||
"Version": "3.9.11.19",
|
||||
"BaseAddr": 93551568
|
||||
},
|
||||
{
|
||||
"Version": "3.9.11.23",
|
||||
"BaseAddr": 93700920
|
||||
},
|
||||
{
|
||||
"Version": "3.9.11.25",
|
||||
"BaseAddr": 93702352
|
||||
},
|
||||
{
|
||||
"Version": "3.9.12.15",
|
||||
"BaseAddr": 93814816
|
||||
},
|
||||
{
|
||||
"Version": "3.9.12.17",
|
||||
"BaseAddr": 93836256
|
||||
},
|
||||
{
|
||||
"Version": "3.9.12.31",
|
||||
"BaseAddr": 94518176
|
||||
},
|
||||
{
|
||||
"Version": "3.9.12.37",
|
||||
"BaseAddr": 94522080
|
||||
},
|
||||
{
|
||||
"Version": "3.9.12.45",
|
||||
"BaseAddr": 94505056
|
||||
},
|
||||
{
|
||||
"Version": "3.9.12.51",
|
||||
"BaseAddr": 94556448
|
||||
}
|
||||
]
|
||||
Reference in New Issue
Block a user