diff --git a/TextLocator/App.xaml.cs b/TextLocator/App.xaml.cs
index 0879bd0ddb6ba947e734e524fbf16116de4cf81c..e248e7bcf207b1fd2d7ca0be8f572a64ba6e4a87 100644
--- a/TextLocator/App.xaml.cs
+++ b/TextLocator/App.xaml.cs
@@ -1,8 +1,6 @@
using Hardcodet.Wpf.TaskbarNotification;
using log4net;
using System;
-using System.Diagnostics;
-using System.Linq;
using System.Runtime.InteropServices;
using System.Text;
using System.Threading;
diff --git a/TextLocator/AreaInfoItem.xaml.cs b/TextLocator/AreaInfoItem.xaml.cs
index f0f10aa02391576370c6f49481125fee04449451..3be55f46d0cef2dad32c964027293798bfb7da33 100644
--- a/TextLocator/AreaInfoItem.xaml.cs
+++ b/TextLocator/AreaInfoItem.xaml.cs
@@ -22,7 +22,7 @@ namespace TextLocator
}
catch
{
- this.Dispatcher.BeginInvoke(new Action(() =>
+ Dispatcher.InvokeAsync(() =>
{
try
{
@@ -32,7 +32,7 @@ namespace TextLocator
{
log.Error(ex.Message, ex);
}
- }));
+ });
}
}
diff --git a/TextLocator/Core/AppConst.cs b/TextLocator/Core/AppConst.cs
index 95602e0e0f6ed493acf2f5af4e95fe59a3d2bf71..14e97eceb7b1128d074d01b529051b7bc107b8e8 100644
--- a/TextLocator/Core/AppConst.cs
+++ b/TextLocator/Core/AppConst.cs
@@ -85,15 +85,15 @@ namespace TextLocator.Core
///
/// 匹配Lucene.NET内置关键词
///
- public static readonly Regex REGEX_BUILT_IN_SYMBOL = new Regex("AND|OR|NOT|\\&\\&|\\|\\|");
+ public static readonly Regex REGEX_BUILT_IN_SYMBOL = new Regex("AND|OR|NOT|\\&\\&|\\|\\||\"|\\~|\\:");
///
/// 匹配支持的通配符
///
- public static readonly Regex REGEX_SUPPORT_WILDCARDS = new Regex("\\+|\\-|\\||\\!|\\(|\\)|\\{|\\}|\\[|\\]|\\^|\"|\\~|\\*|\\?|\\:|\\/");
+ public static readonly Regex REGEX_JUDGMENT = new Regex(@"\.|\\w|\\W|\\s|\\S|\\d|\\D|\\b|\\B|\\f|\\n|\\r|\\t|\\v|\^|\$|\*|\?|\+|\-|\{|\}|\[|\]|\(|\)|\\|\||\!");
///
/// 匹配空白和换行
///
- public static readonly Regex REGEX_LINE_BREAKS_AND_WHITESPACE = new Regex(@" |\r\r|\n\n|┄|\. \. \. |\.\.\.|\s");
+ public static readonly Regex REGEX_LINE_BREAKS_WHITESPACE = new Regex(@" |\r\r|\n\n|┄|\s");
///
/// 匹配HTML和XML标签
///
@@ -161,19 +161,6 @@ namespace TextLocator.Core
/// 区域文件类型
///
public const string AREA_FILE_TYPES_KEY = "AreaFileTypes";
-
- ///
- /// 预览内容分隔列表
- ///
- public const string PREVIEW_CONTENT_SPLIT_LIST_KEY = "PreviewContentSplitList";
- ///
- /// 预览内容关键词列表
- ///
- public const string PREVIEW_FILE_INFO_KEYWORDS_KEY = "PreviewFileInfoKeywords";
- ///
- /// 预览内容是否区分大小写
- ///
- public const string PREVIEW_FILE_INFO_MATCH_CASE_KEY = "PreviewFileInfoIsMatchCase";
}
}
}
diff --git a/TextLocator/Entity/FileInfo.cs b/TextLocator/Entity/FileInfo.cs
index 06cc5c736c0efbfc48302a2f5ce8dd1355e0d7e2..c1be0b1767314d3c34f95428669a1f8b79b07286 100644
--- a/TextLocator/Entity/FileInfo.cs
+++ b/TextLocator/Entity/FileInfo.cs
@@ -43,10 +43,7 @@ namespace TextLocator.Entity
///
private List keywords = new List();
public List Keywords { get => keywords; set => keywords = value; }
- ///
- /// 词频统计
- ///
- public int MatchCount { get; set; }
+
///
/// 搜索域
///
diff --git a/TextLocator/FileInfoItem.xaml b/TextLocator/FileInfoItem.xaml
index 08ed5a3324a217fc8e040909350ba26c5cab6f2a..c34611bdebdb3490a93e69f6020fc548d16d91c7 100644
--- a/TextLocator/FileInfoItem.xaml
+++ b/TextLocator/FileInfoItem.xaml
@@ -16,7 +16,7 @@
-
+
配置信息详细报告.doc
@@ -36,13 +36,15 @@
-
+
-
- ...电脑型号 X64 兼容 台式电脑
+
+ ...电脑型号 X64 兼容 台式电脑
操作系统 Windows 10 专业版 64位 ( Version 2004 / DirectX 12 )
- 处理器 AMD Ryzen 9 3900X 12-Core
+
+ 处理器
+ AMD Ryzen 9 3900X 12-Core
主板 华硕 PRIME X570-P ( AMD PCI 标准主机 CPU 桥 )
显卡 Nvidia GeForce RTX 2080 Ti ( 11 GB / 七彩虹 )
内存 64 GB ( 海盗船 DDR4 3200MHz )...
diff --git a/TextLocator/FileInfoItem.xaml.cs b/TextLocator/FileInfoItem.xaml.cs
index 393f99fc7b18583bbd5c469dd14d732ffdd1c7e4..986e3031aade9eab2138c711ca63a0d00852eb8f 100644
--- a/TextLocator/FileInfoItem.xaml.cs
+++ b/TextLocator/FileInfoItem.xaml.cs
@@ -31,7 +31,7 @@ namespace TextLocator
Refresh(fileInfo, searchRegion);
}
catch {
- this.Dispatcher.BeginInvoke(new Action(() =>
+ Dispatcher.InvokeAsync(() =>
{
try
{
@@ -41,7 +41,7 @@ namespace TextLocator
{
log.Error(ex.Message, ex);
}
- }));
+ });
}
}
@@ -61,41 +61,41 @@ namespace TextLocator
string fileName = fileInfo.FileName;
// 显示文件名称
- RichTextBoxUtil.FillingData(this.FileName, fileName.Length > 55 ? fileName.Substring(0, 55) + "..." : fileName, (Brush)new BrushConverter().ConvertFromString("#1A0DAB"), true);
+ FileContentUtil.FillFlowDocument(this.FileName, fileName.Length > 55 ? fileName.Substring(0, 55) + "..." : fileName, (Brush)new BrushConverter().ConvertFromString("#1A0DAB"), true);
if (searchRegion == Enums.SearchRegion.文件名和内容 || searchRegion == Enums.SearchRegion.仅文件名)
{
- RichTextBoxUtil.Highlighted(this.FileName, Colors.Red, fileInfo.Keywords);
+ FileContentUtil.FlowDocumentHighlight(this.FileName, Colors.Red, fileInfo.Keywords);
}
- string filePath = fileInfo.FilePath.Replace(fileInfo.FileName, "");
+ string folderPath = fileInfo.FilePath.Substring(0, fileInfo.FilePath.LastIndexOf("\\"));
// 文件路径
- this.FileFolder.Text = filePath.Length > 70 ? filePath.Substring(0, 70) + "..." : filePath;
+ this.FileFolder.Text = folderPath.Length > 70 ? folderPath.Substring(0, 70) + "..." : folderPath;
// 获取摘要
- RichTextBoxUtil.EmptyData(this.ContentBreviary);
+ FileContentUtil.EmptyRichTextDocument(this.ContentBreviary);
Task.Factory.StartNew(() => {
string breviary = IndexCore.GetContentBreviary(fileInfo);
- this.Dispatcher.BeginInvoke(new Action(() =>
+ Dispatcher.InvokeAsync(() =>
{
- RichTextBoxUtil.FillingData(this.ContentBreviary, breviary, (Brush)new BrushConverter().ConvertFromString("#545454"));
+ FileContentUtil.FillFlowDocument(this.ContentBreviary, breviary, (Brush)new BrushConverter().ConvertFromString("#545454"));
if (searchRegion == Enums.SearchRegion.文件名和内容 || searchRegion == Enums.SearchRegion.仅文件内容)
{
- RichTextBoxUtil.Highlighted(this.ContentBreviary, Colors.Red, fileInfo.Keywords);
+ FileContentUtil.FlowDocumentHighlight(this.ContentBreviary, Colors.Red, fileInfo.Keywords);
}
- }));
+ });
});
- /*// 词频统计
+ // 词频统计
Task.Factory.StartNew(() => {
- string keywordFrequency = IndexCore.GetKeywordFrequency(fileInfo, searchRegion);
- this.Dispatcher.BeginInvoke(new Action(() => {
- if (!string.IsNullOrWhiteSpace(keywordFrequency))
+ string matchCountDetails = IndexCore.GetMatchCountDetails(fileInfo);
+ Dispatcher.InvokeAsync(() => {
+ if (!string.IsNullOrWhiteSpace(matchCountDetails))
{
// 关键词匹配次数
- this.FileTypeIcon.ToolTip = keywordFrequency;
+ this.FileTypeIcon.ToolTip = matchCountDetails;
}
- }));
- });*/
+ });
+ });
}
}
}
diff --git a/TextLocator/Index/IndexCore.cs b/TextLocator/Index/IndexCore.cs
index 6c290e025344ac109946279ac28ce39cfc966e02..3cc655b6429ccbce4a9fff81cf855664eed0ef6c 100644
--- a/TextLocator/Index/IndexCore.cs
+++ b/TextLocator/Index/IndexCore.cs
@@ -573,7 +573,7 @@ namespace TextLocator.Index
// 文件标记
string fileMark = MD5Util.GetMD5Hash(filePath);
- indexWriters[index].UpdateDocument(new Lucene.Net.Index.Term("FileMark", fileMark), doc);
+ indexWriters[index].UpdateDocument(new Lucene.Net.Index.Term("Id", fileMark), doc);
}
catch (Exception ex)
{
@@ -658,7 +658,7 @@ namespace TextLocator.Index
bool hasContent = param.SearchRegion == SearchRegion.文件名和内容 || param.SearchRegion == SearchRegion.仅文件内容;
// 3.1、---- 关键词正则 或 标记为正则
- if (AppConst.REGEX_SUPPORT_WILDCARDS.IsMatch(keyword))
+ if (AppConst.REGEX_JUDGMENT.IsMatch(keyword))
{
keywordType = "正则";
// 文件名搜索
@@ -828,7 +828,7 @@ namespace TextLocator.Index
};
// 词频统计(所有关键词匹配次数)
- fileInfo.MatchCount = GetMatchCount(fileInfo);
+ // fileInfo.MatchCount = GetMatchCount(fileInfo);
fileInfos.Add(fileInfo);
}
@@ -878,7 +878,85 @@ namespace TextLocator.Index
}
///
- /// 获取关键词词频统计
+ /// 获取内容缩略
+ ///
+ /// 关键词列表
+ /// 预览内容
+ ///
+ public static string GetContentBreviary(Entity.FileInfo fileInfo)
+ {
+ // 获取内容
+ string content = AppConst.REGEX_CONTENT_PAGE.Replace(fileInfo.Preview, "");
+ // 缩略信息
+ string breviary = AppConst.REGEX_LINE_BREAKS_WHITESPACE.Replace(content, "");
+
+ int min = 0;
+ int max = breviary.Length;
+ int subLen = AppConst.FILE_CONTENT_SUB_LENGTH;
+ try
+ {
+ // 内部子方法
+ string ContentBreviary(int index)
+ {
+ int startIndex = index - subLen / 2;
+ int endIndex = index + subLen / 2;
+
+ // 顺序不能乱
+ if (startIndex < min) startIndex = min;
+ if (endIndex > max) endIndex = max;
+ if (startIndex > endIndex) startIndex = endIndex - subLen;
+ if (startIndex < min) startIndex = min;
+ if (startIndex + endIndex < subLen) endIndex = endIndex + subLen - (startIndex + endIndex);
+ if (endIndex > max) endIndex = max;
+
+ breviary = breviary.Substring(startIndex, endIndex - startIndex);
+
+ if (startIndex > min) breviary = "..." + breviary;
+ if (endIndex < max) breviary = breviary + "...";
+ return breviary;
+ }
+
+ foreach (string keyword in fileInfo.Keywords)
+ {
+ if (string.IsNullOrEmpty(keyword)) continue;
+ // 关键词是正则表达式
+ if (AppConst.REGEX_JUDGMENT.IsMatch(keyword))
+ {
+ Regex regex = new Regex(keyword, RegexOptions.IgnoreCase);
+ Match matches = regex.Match(content);
+ if (matches.Success)
+ {
+ return ContentBreviary(matches.Index);
+ }
+ }
+ else
+ {
+ // 可能包含多个keyword,做遍历查找
+ int index = breviary.IndexOf(keyword, 0, StringComparison.CurrentCultureIgnoreCase);
+ if (index != -1)
+ {
+ return ContentBreviary(index);
+ }
+ }
+ }
+ }
+ catch (Exception ex)
+ {
+ log.Error("获取摘要信息失败:" + ex.Message, ex);
+ }
+
+ // 默认预览内容
+ if (breviary.Length > AppConst.FILE_CONTENT_SUB_LENGTH)
+ {
+ breviary = breviary.Substring(0, AppConst.FILE_CONTENT_SUB_LENGTH) + "...";
+ }
+ return breviary;
+ }
+ #endregion
+
+ #region 关键词词频统计(商业版)
+ ///
+ /// 获取关键词词频统计总数
///
/// 文件信息
///
@@ -935,81 +1013,91 @@ namespace TextLocator.Index
return 0;
}
}
-
///
- /// 获取内容缩略
+ /// 获取关键词词频统计详情
///
- /// 关键词列表
- /// 预览内容
+ /// 文件信息
///
- public static string GetContentBreviary(Entity.FileInfo fileInfo)
+ public static string GetMatchCountDetails(Entity.FileInfo fileInfo)
{
- // 获取内容
- string content = AppConst.REGEX_CONTENT_PAGE.Replace(fileInfo.Preview, "");
- // 缩略信息
- string breviary = AppConst.REGEX_LINE_BREAKS_AND_WHITESPACE.Replace(content, "");
-
- int min = 0;
- int max = breviary.Length;
- int subLen = AppConst.FILE_CONTENT_SUB_LENGTH;
try
{
- // 内部子方法
- string ContentBreviary(int index)
- {
- int startIndex = index - subLen / 2;
- int endIndex = index + subLen / 2;
-
- // 顺序不能乱
- if (startIndex < min) startIndex = min;
- if (endIndex > max) endIndex = max;
- if (startIndex > endIndex) startIndex = endIndex - subLen;
- if (startIndex < min) startIndex = min;
- if (startIndex + endIndex < subLen) endIndex = endIndex + subLen - (startIndex + endIndex);
- if (endIndex > max) endIndex = max;
-
- breviary = breviary.Substring(startIndex, endIndex - startIndex);
-
- if (startIndex > min) breviary = "..." + breviary;
- if (endIndex < max) breviary = breviary + "...";
- return breviary;
- }
+ TaskTime taskTime = TaskTime.StartNew();
+ // 定义词频词典
+ Dictionary matchCountDic = new Dictionary();
+ // 遍历关键词
foreach (string keyword in fileInfo.Keywords)
{
- if (string.IsNullOrEmpty(keyword)) continue;
- // 关键词是正则表达式
- if (AppConst.REGEX_SUPPORT_WILDCARDS.IsMatch(keyword))
+ // 匹配内容
+ int nameMatchCount = 0, contentMatchCount = 0;
+ // 声明正则
+ Regex regex = new Regex(keyword);
+
+ // ---- 匹配文件名
+ if (fileInfo.SearchRegion == SearchRegion.文件名和内容 || fileInfo.SearchRegion == SearchRegion.仅文件名)
{
- Regex regex = new Regex(keyword, RegexOptions.IgnoreCase);
- Match matches = regex.Match(content);
- if (matches.Success)
+ // 匹配文件名
+ Match matchName = regex.Match(fileInfo.FileName);
+ // 文件名匹配成功
+ if (matchName.Success)
{
- return ContentBreviary(matches.Index);
+ // 获取匹配次数
+ nameMatchCount = regex.Matches(fileInfo.FileName).Count;
}
}
- else
+
+ // ---- 匹配文件内容
+ if (fileInfo.SearchRegion == SearchRegion.文件名和内容 || fileInfo.SearchRegion == SearchRegion.仅文件内容)
{
- // 可能包含多个keyword,做遍历查找
- int index = breviary.IndexOf(keyword, 0, StringComparison.CurrentCultureIgnoreCase);
- if (index != -1)
+ // 获取内容(预览内容替换----\d+----)
+ string content = AppConst.REGEX_CONTENT_PAGE.Replace(fileInfo.Preview, "");
+
+ // 匹配文件内容
+ Match matchContent = regex.Match(content);
+ // 文件内容匹配成功
+ if (matchContent.Success)
{
- return ContentBreviary(index);
+ // 获取匹配次数
+ contentMatchCount = regex.Matches(content).Count;
}
}
+
+ // 匹配数量合并
+ int count = nameMatchCount + contentMatchCount;
+ // 匹配次数大于才是有效值
+ if (count > 0)
+ {
+ matchCountDic[keyword] = count;
+ }
+ }
+
+ StringBuilder builder = new StringBuilder();
+ // 获取匹配词列表
+ List matchCountList = matchCountDic.Keys.ToList();
+ for (int k = 0; k < matchCountList.Count; k++)
+ {
+ // 词频统计信息
+ builder.Append(string.Format("{0}:{1};", matchCountList[k], matchCountDic[matchCountList[k]]));
+ // 自动换行 && (下标不是0 && 每4次 && 下标不是最大)
+ if (k > 0 && k % 6 == 0 && k < matchCountList.Count - 1)
+ {
+ builder.Append("\r\n");
+ }
+ }
+ string text = builder.ToString();
+ if (text.EndsWith(","))
+ {
+ text = text.Substring(0, text.Length - 1);
}
+ log.Debug(fileInfo.FileName + " -> 词频统计耗时:" + taskTime.ConsumeTime + " 统计词频:" + text);
+ return text;
}
catch (Exception ex)
{
- log.Error("获取摘要信息失败:" + ex.Message, ex);
- }
-
- // 默认预览内容
- if (breviary.Length > AppConst.FILE_CONTENT_SUB_LENGTH)
- {
- breviary = breviary.Substring(0, AppConst.FILE_CONTENT_SUB_LENGTH) + "...";
+ log.Error("获取关键词词频统计失败:" + ex.Message, ex);
+ return null;
}
- return breviary;
}
#endregion
diff --git a/TextLocator/MainWindow.xaml b/TextLocator/MainWindow.xaml
index 0346c0ab72ff81c81ef9e37fbf9260527aa10246..d8437acdf66feed8dab8ac365c85e495949daba8 100644
--- a/TextLocator/MainWindow.xaml
+++ b/TextLocator/MainWindow.xaml
@@ -7,10 +7,9 @@
xmlns:rubyer="clr-namespace:Rubyer;assembly=Rubyer"
mc:Ignorable="d"
Title="文本搜索定位器" Width="1600" Height="900" Icon="Resource/App.ico"
- DataContext="{Binding RelativeSource={RelativeSource Self}}"
WindowStartupLocation="CenterScreen" Loaded="Window_Loaded" Closing="Window_Closing" Activated="Window_Activated">
-
+
@@ -162,9 +161,15 @@
-
- 配置信息详细报告.doc
-
+
+
+
+ 配置
+ 信息
+ 详细报告.doc
+
+
+
@@ -185,7 +190,9 @@
...电脑型号 X64 兼容 台式电脑
操作系统 Windows 10 专业版 64位 ( Version 2004 / DirectX 12 )
- 处理器 AMD Ryzen 9 3900X 12-Core
+
+ 处理器
+ Ryzen 9 3900X 12-Core
主板 华硕 PRIME X570-P ( AMD PCI 标准主机 CPU 桥 )
显卡 Nvidia GeForce RTX 2080 Ti ( 11 GB / 七彩虹 )
内存 64 GB ( 海盗船 DDR4 3200MHz )...
@@ -205,12 +212,18 @@
-
+
+
@@ -234,595 +247,659 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
-
+
-
+
+
+ --------[ 概览 ]--------------------------------------------------------------------------
+
+
+
+
+
+ 电脑型号 X64 兼容 台式电脑
+ 操作系统 Windows 10 专业版 64位 ( Version 2004 / DirectX 12 )
+
+
+ 处理器
+ AMD Ryzen 9 3900X 12-Core
+ 主板 华硕 PRIME X570-P ( AMD PCI 标准主机 CPU 桥 )
+ 显卡 Nvidia GeForce RTX 2080 Ti ( 11 GB / 七彩虹 )
+ 内存 64 GB ( 海盗船
+ DDR4
+ 3200MHz )
+ 主硬盘 创见 TS256GMTE220S ( 256 GB / 固态硬盘 )
+ 显示器 冠捷 AOC2790 U2790B ( 27.2 英寸 )
+ 声卡 瑞昱 @ AMD High Definition Audio 控制器
+ 网卡 瑞昱 RTL8168/8111/8112 Gigabit Ethernet Controller / 华硕
+
+
+
+
+ --------[ 主板 ]--------------------------------------------------------------------------
+
+
+
+
+
+ 主板型号 华硕 PRIME X570-P
+ 芯片组 AMD PCI 标准主机 CPU 桥
+ 序列号 190652794505186
+ 主板版本 Rev X.0x
+ BIOS American Megatrends Inc. 2204 / BIOS程序发布日期: 06/17/2020
+ BIOS的大小 16384 KB
+ BIOS的序列号 IeiEr3Ul6IOzeS4EAT8EQeiGuD
+
+ 板载设备 视频设备 (启用)
+
+
+
+
+ --------[
+ 处理器
+ ]-----------------------------------------------------------------------
+
+
+
+
+ 处理器
+ AMD Ryzen 9 3900X 12-Core
+ 速度 3.80 GHz (100 MHz x 38.0)
+
+ 处理器
+ 数量 核心数: 12 / 线程数: 24
+ 插槽/插座 AM4
+ 一级数据缓存 32 KB, 16-Way, 64 byte lines
+ 一级代码缓存 32 KB, 16-Way, 64 byte lines
+ 二级缓存 12 x 512 KB, 8-Way, 64 byte lines
+ 三级缓存 64 MB, 8-Way, 64 byte lines
+ 特征 MMX+, SSE, SSE2, SSE3, SSSE3, SSE4A, SSE4.1, HTT, X86-64
+
+
+
+
+ --------[ 硬盘 ]--------------------------------------------------------------------------
+
+
- --------[ 概览 ]----------------------------------------------------------------------------------
-
- 电脑型号 X64 兼容 台式电脑
- 操作系统 Windows 10 专业版 64位 ( Version 2004 / DirectX 12 )
-
- 处理器 AMD Ryzen 9 3900X 12-Core
- 主板 华硕 PRIME X570-P ( AMD PCI 标准主机 CPU 桥 )
- 显卡 Nvidia GeForce RTX 2080 Ti ( 11 GB / 七彩虹 )
- 内存 64 GB ( 海盗船 DDR4 3200MHz )
- 主硬盘 创见 TS256GMTE220S ( 256 GB / 固态硬盘 )
- 显示器 冠捷 AOC2790 U2790B ( 27.2 英寸 )
- 声卡 瑞昱 @ AMD High Definition Audio 控制器
- 网卡 瑞昱 RTL8168/8111/8112 Gigabit Ethernet Controller / 华硕
- --------[ 主板 ]----------------------------------------------------------------------------------
-
- 主板型号 华硕 PRIME X570-P
- 芯片组 AMD PCI 标准主机 CPU 桥
- 序列号 190652794505186
- 主板版本 Rev X.0x
- BIOS American Megatrends Inc. 2204 / BIOS程序发布日期: 06/17/2020
- BIOS的大小 16384 KB
- BIOS的序列号 IeiEr3Ul6IOzeS4EAT8EQeiGuD
-
- 板载设备 视频设备 (启用)
-
- --------[ 处理器 ]--------------------------------------------------------------------------------
-
- 处理器 AMD Ryzen 9 3900X 12-Core
- 速度 3.80 GHz (100 MHz x 38.0)
- 处理器数量 核心数: 12 / 线程数: 24
- 插槽/插座 AM4
- 一级数据缓存 32 KB, 16-Way, 64 byte lines
- 一级代码缓存 32 KB, 16-Way, 64 byte lines
- 二级缓存 12 x 512 KB, 8-Way, 64 byte lines
- 三级缓存 64 MB, 8-Way, 64 byte lines
- 特征 MMX+, SSE, SSE2, SSE3, SSSE3, SSE4A, SSE4.1, HTT, X86-64
-
- --------[ 硬盘 ]----------------------------------------------------------------------------------
-
- 产品 西数 WDC WD10JPVX-22JC3T0
- 大小 1 TB
- 转速 5400 转/分
- 缓存 8 MB
- 硬盘已使用 共 1493 次,累计 10617 小时
- 固件 01.01A01
- 接口 SATA III
- 数据传输率 600.00 MB/秒
- 特征 S.M.A.R.T, APM, 48-bit LBA, NCQ
-
- 产品 西数 WDC WD10JPVX-22JC3T0
- 大小 1 TB
- 转速 5400 转/分
- 缓存 8 MB
- 硬盘已使用 共 238 次,累计 594 小时
- 固件 01.01A01
- 接口 SATA III
- 数据传输率 600.00 MB/秒
- 特征 S.M.A.R.T, APM, 48-bit LBA, NCQ
-
- 产品 希捷 ST2000DM008-2FR102
- 大小 2 TB
- 转速 7200 转/分
- 缓存 256 MB
- 硬盘已使用 共 430 次,累计 4274 小时
- 固件 0001
- 接口 SATA III
- 数据传输率 600.00 MB/秒
- 特征 S.M.A.R.T, APM, 48-bit LBA, NCQ
-
- 产品 创见 TS256GMTE220S (固态硬盘)
- 大小 256 GB
- 硬盘已使用 共 286 次,累计 3809 小时
- 固件 S0328C
- 接口 NVM Express
- 特征 S.M.A.R.T
-
- 产品 Asgard AN2+ 256NVMe-M.2/80 (固态硬盘)
- 大小 256 GB
- 硬盘已使用 共 441 次,累计 4271 小时
- 固件 S0614B0G
- 接口 NVM Express
- 特征 S.M.A.R.T
-
- --------[ 内存 ]----------------------------------------------------------------------------------
-
- DIMM_A1 海盗船 DDR4 3200MHz 16GB
- 型号 7F7F9E CM4X16GC3200C16K2E
- 厂商 Corsair
- 模块位宽: 64 Bits
- 模块电压: SSTL 1.2V
-
- DIMM_A2 海盗船 DDR4 3200MHz 16GB
- 型号 7F7F9E CM4X16GC3200C16K2E
- 厂商 Corsair
- 模块位宽: 64 Bits
- 模块电压: SSTL 1.2V
-
- DIMM_B1 海盗船 DDR4 3200MHz 16GB
- 型号 7F7F9E CM4X16GC3200C16K2E
- 厂商 Corsair
- 模块位宽: 64 Bits
- 模块电压: SSTL 1.2V
-
- DIMM_B2 海盗船 DDR4 3200MHz 16GB
- 型号 7F7F9E CM4X16GC3200C16K2E
- 厂商 Corsair
- 模块位宽: 64 Bits
- 模块电压: SSTL 1.2V
-
- --------[ 显卡 ]----------------------------------------------------------------------------------
-
- 主显卡 Nvidia GeForce RTX 2080 Ti
- 显存 11 GB
- 制造商 七彩虹
- 制造商 Nvidia
- 驱动版本 27.21.14.5148
- 驱动日期 20200621
-
- --------[ 显示器 ]--------------------------------------------------------------------------------
-
- 产品 冠捷 AOC2790 U2790B
- 厂商 冠捷
- 固件程序日期 2019 年 38 周 (非显示器制造日期)
- 屏幕尺寸 27.2 英寸 (60 厘米 x 34 厘米)
- 显示比例 宽屏 16 : 9
- 分辨率 3840 x 2160 32 位真彩色
- Gamma 2.20
- 电源管理 Active-Off
-
- --------[ 其他设备 ]------------------------------------------------------------------------------
-
-
- 网卡 瑞昱 RTL8168/8111/8112 Gigabit Ethernet Controller
- 制造商 华硕
-
- 无线网卡 瑞昱 802.11n NIC
-
- 声卡 Nvidia GeForce 7800 GTX @ Nvidia High Definition Audio 控制器
-
- 声卡 瑞昱 @ AMD High Definition Audio 控制器
-
- 键盘 HID 标准键盘
- 键盘 HID 标准键盘
- 键盘 HID 标准键盘
- 鼠标 HID-compliant 鼠标
-
-
- --------[ PCI设备 ]-------------------------------------------------------------------------------
-
- 设备 PCI 标准主机 CPU 桥
- 设备ID 1480
- 制造商 AMD
- 制造商ID 1022
- 类别 Bridge / PCI to HOST
- 子系统制造商 ASUSTeK
- 子系统ID 87C01043
-
- 设备 IOMMU Device
- 设备ID 1481
- 制造商 AMD
- 制造商ID 1022
- 类别 System /
- 子系统制造商 ASUSTeK
- 子系统ID 87C01043
-
- 设备 PCI 标准主机 CPU 桥
- 设备ID 1482
- 制造商 AMD
- 制造商ID 1022
- 类别 Bridge / PCI to HOST
- 子系统ID 00000000
-
- 设备 PCI 到 PCI 桥
- 设备ID 1483
- 制造商 AMD
- 制造商ID 1022
- 类别 Bridge / PCI to PCI
- 子系统ID 00000000
-
- 设备 PCI 到 PCI 桥
- 设备ID 1483
- 制造商 AMD
- 制造商ID 1022
- 类别 Bridge / PCI to PCI
- 子系统ID 00000000
-
- 设备 PCI 标准主机 CPU 桥
- 设备ID 1482
- 制造商 AMD
- 制造商ID 1022
- 类别 Bridge / PCI to HOST
- 子系统ID 00000000
-
- 设备 PCI 标准主机 CPU 桥
- 设备ID 1482
- 制造商 AMD
- 制造商ID 1022
- 类别 Bridge / PCI to HOST
- 子系统ID 00000000
-
- 设备 PCI 到 PCI 桥
- 设备ID 1483
- 制造商 AMD
- 制造商ID 1022
- 类别 Bridge / PCI to PCI
- 子系统ID 00000000
-
- 设备 PCI 标准主机 CPU 桥
- 设备ID 1482
- 制造商 AMD
- 制造商ID 1022
- 类别 Bridge / PCI to HOST
- 子系统ID 00000000
-
- 设备 PCI 标准主机 CPU 桥
- 设备ID 1482
- 制造商 AMD
- 制造商ID 1022
- 类别 Bridge / PCI to HOST
- 子系统ID 00000000
-
- 设备 PCI 标准主机 CPU 桥
- 设备ID 1482
- 制造商 AMD
- 制造商ID 1022
- 类别 Bridge / PCI to HOST
- 子系统ID 00000000
-
- 设备 PCI 到 PCI 桥
- 设备ID 1484
- 制造商 AMD
- 制造商ID 1022
- 类别 Bridge / PCI to PCI
- 子系统ID 00000000
-
- 设备 PCI 标准主机 CPU 桥
- 设备ID 1482
- 制造商 AMD
- 制造商ID 1022
- 类别 Bridge / PCI to HOST
- 子系统ID 00000000
-
- 设备 PCI 到 PCI 桥
- 设备ID 1484
- 制造商 AMD
- 制造商ID 1022
- 类别 Bridge / PCI to PCI
- 子系统ID 00000000
-
- 设备 SMBus
- 设备ID 790B
- 制造商 AMD
- 制造商ID 1022
- 类别 Serial / SMBus Controller
- 子系统制造商 ASUSTeK
- 子系统ID 87C01043
-
- 设备 PCI 标准 ISA 桥
- 设备ID 790E
- 制造商 AMD
- 制造商ID 1022
- 类别 Bridge / PCI to ISA
- 子系统制造商 ASUSTeK
- 子系统ID 87C01043
-
- 设备 PCI 标准主机 CPU 桥
- 设备ID 1440
- 制造商 AMD
- 制造商ID 1022
- 类别 Bridge / PCI to HOST
- 子系统ID 00000000
-
- 设备 PCI 标准主机 CPU 桥
- 设备ID 1441
- 制造商 AMD
- 制造商ID 1022
- 类别 Bridge / PCI to HOST
- 子系统ID 00000000
-
- 设备 PCI 标准主机 CPU 桥
- 设备ID 1442
- 制造商 AMD
- 制造商ID 1022
- 类别 Bridge / PCI to HOST
- 子系统ID 00000000
-
- 设备 PCI 标准主机 CPU 桥
- 设备ID 1443
- 制造商 AMD
- 制造商ID 1022
- 类别 Bridge / PCI to HOST
- 子系统ID 00000000
-
- 设备 PCI 标准主机 CPU 桥
- 设备ID 1444
- 制造商 AMD
- 制造商ID 1022
- 类别 Bridge / PCI to HOST
- 子系统ID 00000000
-
- 设备 PCI 标准主机 CPU 桥
- 设备ID 1445
- 制造商 AMD
- 制造商ID 1022
- 类别 Bridge / PCI to HOST
- 子系统ID 00000000
-
- 设备 PCI 标准主机 CPU 桥
- 设备ID 1446
- 制造商 AMD
- 制造商ID 1022
- 类别 Bridge / PCI to HOST
- 子系统ID 00000000
-
- 设备 PCI 标准主机 CPU 桥
- 设备ID 1447
- 制造商 AMD
- 制造商ID 1022
- 类别 Bridge / PCI to HOST
- 子系统ID 00000000
-
- 设备 标准 NVM Express 控制器
- 设备ID 2262
- 制造商 Silicon Motion
- 制造商ID 126F
- 类别 Storage /
- 子系统制造商 Silicon Motion
- 子系统ID 2262126F
-
- 设备 X570 Chipset
- 设备ID 57AD
- 制造商 AMD
- 制造商ID 1022
- 类别 Bridge / PCI to PCI
- 子系统ID 00000000
-
- 设备 PCI Express 下游交换机端口
- 设备ID 57A3
- 制造商 AMD
- 制造商ID 1022
- 类别 Bridge / PCI to PCI
- 子系统ID 00000000
-
- 设备 PCI Express 下游交换机端口
- 设备ID 57A3
- 制造商 AMD
- 制造商ID 1022
- 类别 Bridge / PCI to PCI
- 子系统ID 00000000
-
- 设备 PCI Express 下游交换机端口
- 设备ID 57A4
- 制造商 AMD
- 制造商ID 1022
- 类别 Bridge / PCI to PCI
- 子系统ID 00000000
-
- 设备 PCI Express 下游交换机端口
- 设备ID 57A4
- 制造商 AMD
- 制造商ID 1022
- 类别 Bridge / PCI to PCI
- 子系统ID 00000000
-
- 设备 PCI Express 下游交换机端口
- 设备ID 57A4
- 制造商 AMD
- 制造商ID 1022
- 类别 Bridge / PCI to PCI
- 子系统ID 00000000
-
- 设备 标准 NVM Express 控制器
- 设备ID 2263
- 制造商 Silicon Motion
- 制造商ID 126F
- 类别 Storage /
- 子系统制造商 Silicon Motion
- 子系统ID 2263126F
-
- 设备 RTL8168/8111/8112 Gigabit Ethernet Controller
- 设备ID 8168
- 制造商 Realtek
- 制造商ID 10EC
- 类别 Network / Ethernet
- 子系统制造商 ASUSTeK
- 子系统ID 86771043
-
- 设备 PCI
- 设备ID 1485
- 制造商 AMD
- 制造商ID 1022
- 类别 /
- 子系统制造商 ASUSTeK
- 子系统ID 87C01043
-
- 设备 符合 USB xHCI 的主机控制器
- 设备ID 149C
- 制造商 AMD
- 制造商ID 1022
- 类别 Serial / USB (UHCI)
- 子系统制造商 ASUSTeK
- 子系统ID 87C01043
-
- 设备 符合 USB xHCI 的主机控制器
- 设备ID 149C
- 制造商 AMD
- 制造商ID 1022
- 类别 Serial / USB (UHCI)
- 子系统制造商 AMD
- 子系统ID 148C1022
-
- 设备 标准 SATA AHCI 控制器
- 设备ID 7901
- 制造商 AMD
- 制造商ID 1022
- 类别 Storage / Serial ATA (AHCI 1.0)
- 子系统制造商 AMD
- 子系统ID 79011022
-
- 设备 标准 SATA AHCI 控制器
- 设备ID 7901
- 制造商 AMD
- 制造商ID 1022
- 类别 Storage / Serial ATA (AHCI 1.0)
- 子系统制造商 AMD
- 子系统ID 79011022
-
- 设备 GeForce RTX 2080 Ti
- 设备ID 1E04
- 制造商 Nvidia
- 制造商ID 10DE
- 类别 Display / VGA
- 子系统制造商 Colorful
- 子系统ID 16507377
-
- 设备 High Definition Audio 控制器
- 设备ID 10F7
- 制造商 Nvidia
- 制造商ID 10DE
- 类别 Multimedia / Hi-definition Audio
- 子系统制造商 Colorful
- 子系统ID 16507377
-
- 设备 USB 3.10 可扩展主机控制器 - 1.10 (Microsoft)
- 设备ID 1AD6
- 制造商 Nvidia
- 制造商ID 10DE
- 类别 Serial / USB (UHCI)
- 子系统制造商 Colorful
- 子系统ID 16507377
-
- 设备 USB Type-C Port Policy Controller
- 设备ID 1AD7
- 制造商 Nvidia
- 制造商ID 10DE
- 类别 Serial / Other
- 子系统制造商 Colorful
- 子系统ID 16507377
-
- 设备 PCI
- 设备ID 148A
- 制造商 AMD
- 制造商ID 1022
- 类别 /
- 子系统制造商 ASUSTeK
- 子系统ID 87C01043
-
- 设备 PCI
- 设备ID 1485
- 制造商 AMD
- 制造商ID 1022
- 类别 /
- 子系统制造商 ASUSTeK
- 子系统ID 87C01043
-
- 设备 PSP 11.0 Device
- 设备ID 1486
- 制造商 AMD
- 制造商ID 1022
- 类别 En/Decryption / Other
- 子系统制造商 ASUSTeK
- 子系统ID 87C01043
-
- 设备 符合 USB xHCI 的主机控制器
- 设备ID 149C
- 制造商 AMD
- 制造商ID 1022
- 类别 Serial / USB (UHCI)
- 子系统制造商 ASUSTeK
- 子系统ID 87C01043
-
- 设备 High Definition Audio 控制器
- 设备ID 1487
- 制造商 AMD
- 制造商ID 1022
- 类别 Multimedia / Hi-definition Audio
- 子系统制造商 ASUSTeK
- 子系统ID 87BB1043
-
- --------[ USB设备 ]-------------------------------------------------------------------------------
-
- 制造商ID 18F8
- 产品ID 1286
- 类别 0 / 0 / 0
- 设备 ? USB GAMING MOUSE
- Serial ?
- 版本 USB 1.1
-
- 制造商ID 0BDA
- 产品ID 8179
- 类别 0 / 0 / 0
- 设备 Realtek 802.11n NIC
- Serial 00E04C0001
- 版本 USB 2.0
-
- 制造商ID 0C45
- 产品ID 6510
- 类别 0 / 0 / 0
- 设备 SONiX USB DEVICE
- Serial ?
- 版本 USB 2.0
-
- 制造商ID 0B05
- 产品ID 18F3
- 类别 0 / 0 / 0
- 设备 AsusTek Computer Inc. AURA LED Controller
- Serial 9876543210
- 版本 USB 2.0
-
- --------[ 传感器 ]--------------------------------------------------------------------------------
-
- 名称 WINBOND NCT6798D
- CPU温度 73℃
- CPU核心 74℃
- 主板 36℃
- 显卡 58℃
- 硬盘温度 42℃
- 风扇 1050转
+ 产品 西数 WDC WD10JPVX-22JC3T0
+ 大小 1 TB
+ 转速 5400 转/分
+ 缓存 8 MB
+ 硬盘已使用 共 1493 次,累计 10617 小时
+ 固件 01.01A01
+
+ 接口
+ SATA III
+ 数据传输率 600.00 MB/秒
+ 特征 S.M.A.R.T, APM, 48-bit LBA, NCQ
+
+ 产品 西数 WDC WD10JPVX-22JC3T0
+ 大小 1 TB
+ 转速 5400 转/分
+ 缓存 8 MB
+ 硬盘已使用 共 238 次,累计 594 小时
+ 固件 01.01A01
+
+ 接口
+ SATA III
+ 数据传输率 600.00 MB/秒
+ 特征 S.M.A.R.T, APM, 48-bit LBA, NCQ
+
+ 产品 希捷 ST2000DM008-2FR102
+ 大小 2 TB
+ 转速 7200 转/分
+ 缓存 256 MB
+ 硬盘已使用 共 430 次,累计 4274 小时
+ 固件 0001
+
+ 接口
+ SATA III
+ 数据传输率 600.00 MB/秒
+ 特征 S.M.A.R.T, APM, 48-bit LBA, NCQ
+
+ 产品 创见 TS256GMTE220S (固态硬盘)
+ 大小 256 GB
+ 硬盘已使用 共 286 次,累计 3809 小时
+ 固件 S0328C
+
+ 接口
+ NVM Express
+ 特征 S.M.A.R.T
+
+ 产品 Asgard AN2+ 256NVMe-M.2/80 (固态硬盘)
+ 大小 256 GB
+ 硬盘已使用 共 441 次,累计 4271 小时
+ 固件 S0614B0G
+
+ 接口
+ NVM Express
+ 特征 S.M.A.R.T
+
+ --------[ 内存 ]--------------------------------------------------------------------------
+
+
+
+
+ DIMM_A1 海盗船
+ DDR4
+ 3200MHz 16GB
+ 型号 7F7F9E CM4X16GC3200C16K2E
+ 厂商 Corsair
+ 模块位宽: 64 Bits
+ 模块电压: SSTL 1.2V
+
+ DIMM_A2 海盗船
+ DDR4
+ 3200MHz 16GB
+ 型号 7F7F9E CM4X16GC3200C16K2E
+ 厂商 Corsair
+ 模块位宽: 64 Bits
+ 模块电压: SSTL 1.2V
+
+ DIMM_B1 海盗船
+ DDR4
+ 3200MHz 16GB
+ 型号 7F7F9E CM4X16GC3200C16K2E
+ 厂商 Corsair
+ 模块位宽: 64 Bits
+ 模块电压: SSTL 1.2V
+
+ DIMM_B2 海盗船
+ DDR4
+ 3200MHz 16GB
+ 型号 7F7F9E CM4X16GC3200C16K2E
+ 厂商 Corsair
+ 模块位宽: 64 Bits
+ 模块电压: SSTL 1.2V
+
+
+
+
+ --------[ 显卡 ]--------------------------------------------------------------------------
+
+
+
+
+ 主显卡 Nvidia GeForce RTX 2080 Ti
+ 显存 11 GB
+ 制造商 七彩虹
+ 制造商 Nvidia
+ 驱动版本 27.21.14.5148
+ 驱动日期 20200621
+
+
+
+
+ --------[ 显示器 ]--------------------------------------------------------------------------------
+
+
+
+
+ 产品 冠捷 AOC2790 U2790B
+ 厂商 冠捷
+ 固件程序日期 2019 年 38 周 (非显示器制造日期)
+ 屏幕尺寸 27.2 英寸 (60 厘米 x 34 厘米)
+ 显示比例 宽屏 16 : 9
+ 分辨率 3840 x 2160 32 位真彩色
+ Gamma 2.20
+ 电源管理 Active-Off
+
+
+
+
+ --------[ 其他设备 ]------------------------------------------------------------------------------
+
+
+
+
+
+ 网卡 瑞昱 RTL8168/8111/8112 Gigabit Ethernet Controller
+ 制造商 华硕
+
+ 无线网卡 瑞昱 802.11n NIC
+
+ 声卡 Nvidia GeForce 7800 GTX @ Nvidia High Definition Audio 控制器
+
+ 声卡 瑞昱 @ AMD High Definition Audio 控制器
+
+ 键盘 HID 标准键盘
+ 键盘 HID 标准键盘
+ 键盘 HID 标准键盘
+ 鼠标 HID-compliant 鼠标
+
+
+
+
+
+ --------[ PCI设备 ]-------------------------------------------------------------------------------
+
+
+
+
+ 设备 PCI 标准主机 CPU 桥
+ 设备ID 1480
+ 制造商 AMD
+ 制造商ID 1022
+ 类别 Bridge / PCI to HOST
+ 子系统制造商 ASUSTeK
+ 子系统ID 87C01043
+
+ 设备 IOMMU Device
+ 设备ID 1481
+ 制造商 AMD
+ 制造商ID 1022
+ 类别 System /
+ 子系统制造商 ASUSTeK
+ 子系统ID 87C01043
+
+ 设备 PCI 标准主机 CPU 桥
+ 设备ID 1482
+ 制造商 AMD
+ 制造商ID 1022
+ 类别 Bridge / PCI to HOST
+ 子系统ID 00000000
+
+ 设备 PCI 到 PCI 桥
+ 设备ID 1483
+ 制造商 AMD
+ 制造商ID 1022
+ 类别 Bridge / PCI to PCI
+ 子系统ID 00000000
+
+ 设备 PCI 到 PCI 桥
+ 设备ID 1483
+ 制造商 AMD
+ 制造商ID 1022
+ 类别 Bridge / PCI to PCI
+ 子系统ID 00000000
+
+ 设备 PCI 标准主机 CPU 桥
+ 设备ID 1482
+ 制造商 AMD
+ 制造商ID 1022
+ 类别 Bridge / PCI to HOST
+ 子系统ID 00000000
+
+ 设备 PCI 标准主机 CPU 桥
+ 设备ID 1482
+ 制造商 AMD
+ 制造商ID 1022
+ 类别 Bridge / PCI to HOST
+ 子系统ID 00000000
+
+ 设备 PCI 到 PCI 桥
+ 设备ID 1483
+ 制造商 AMD
+ 制造商ID 1022
+ 类别 Bridge / PCI to PCI
+ 子系统ID 00000000
+
+ 设备 PCI 标准主机 CPU 桥
+ 设备ID 1482
+ 制造商 AMD
+ 制造商ID 1022
+ 类别 Bridge / PCI to HOST
+ 子系统ID 00000000
+
+ 设备 PCI 标准主机 CPU 桥
+ 设备ID 1482
+ 制造商 AMD
+ 制造商ID 1022
+ 类别 Bridge / PCI to HOST
+ 子系统ID 00000000
+
+ 设备 PCI 标准主机 CPU 桥
+ 设备ID 1482
+ 制造商 AMD
+ 制造商ID 1022
+ 类别 Bridge / PCI to HOST
+ 子系统ID 00000000
+
+ 设备 PCI 到 PCI 桥
+ 设备ID 1484
+ 制造商 AMD
+ 制造商ID 1022
+ 类别 Bridge / PCI to PCI
+ 子系统ID 00000000
+
+ 设备 PCI 标准主机 CPU 桥
+ 设备ID 1482
+ 制造商 AMD
+ 制造商ID 1022
+ 类别 Bridge / PCI to HOST
+ 子系统ID 00000000
+
+ 设备 PCI 到 PCI 桥
+ 设备ID 1484
+ 制造商 AMD
+ 制造商ID 1022
+ 类别 Bridge / PCI to PCI
+ 子系统ID 00000000
+
+ 设备 SMBus
+ 设备ID 790B
+ 制造商 AMD
+ 制造商ID 1022
+ 类别 Serial / SMBus Controller
+ 子系统制造商 ASUSTeK
+ 子系统ID 87C01043
+
+ 设备 PCI 标准 ISA 桥
+ 设备ID 790E
+ 制造商 AMD
+ 制造商ID 1022
+ 类别 Bridge / PCI to ISA
+ 子系统制造商 ASUSTeK
+ 子系统ID 87C01043
+
+ 设备 PCI 标准主机 CPU 桥
+ 设备ID 1440
+ 制造商 AMD
+ 制造商ID 1022
+ 类别 Bridge / PCI to HOST
+ 子系统ID 00000000
+
+ 设备 PCI 标准主机 CPU 桥
+ 设备ID 1441
+ 制造商 AMD
+ 制造商ID 1022
+ 类别 Bridge / PCI to HOST
+ 子系统ID 00000000
+
+ 设备 PCI 标准主机 CPU 桥
+ 设备ID 1442
+ 制造商 AMD
+ 制造商ID 1022
+ 类别 Bridge / PCI to HOST
+ 子系统ID 00000000
+
+ 设备 PCI 标准主机 CPU 桥
+ 设备ID 1443
+ 制造商 AMD
+ 制造商ID 1022
+ 类别 Bridge / PCI to HOST
+ 子系统ID 00000000
+
+ 设备 PCI 标准主机 CPU 桥
+ 设备ID 1444
+ 制造商 AMD
+ 制造商ID 1022
+ 类别 Bridge / PCI to HOST
+ 子系统ID 00000000
+
+ 设备 PCI 标准主机 CPU 桥
+ 设备ID 1445
+ 制造商 AMD
+ 制造商ID 1022
+ 类别 Bridge / PCI to HOST
+ 子系统ID 00000000
+
+ 设备 PCI 标准主机 CPU 桥
+ 设备ID 1446
+ 制造商 AMD
+ 制造商ID 1022
+ 类别 Bridge / PCI to HOST
+ 子系统ID 00000000
+
+ 设备 PCI 标准主机 CPU 桥
+ 设备ID 1447
+ 制造商 AMD
+ 制造商ID 1022
+ 类别 Bridge / PCI to HOST
+ 子系统ID 00000000
+
+ 设备 标准 NVM Express 控制器
+ 设备ID 2262
+ 制造商 Silicon Motion
+ 制造商ID 126F
+ 类别 Storage /
+ 子系统制造商 Silicon Motion
+ 子系统ID 2262126F
+
+ 设备 X570 Chipset
+ 设备ID 57AD
+ 制造商 AMD
+ 制造商ID 1022
+ 类别 Bridge / PCI to PCI
+ 子系统ID 00000000
+
+ 设备 PCI Express 下游交换机端口
+ 设备ID 57A3
+ 制造商 AMD
+ 制造商ID 1022
+ 类别 Bridge / PCI to PCI
+ 子系统ID 00000000
+
+ 设备 PCI Express 下游交换机端口
+ 设备ID 57A3
+ 制造商 AMD
+ 制造商ID 1022
+ 类别 Bridge / PCI to PCI
+ 子系统ID 00000000
+
+ 设备 PCI Express 下游交换机端口
+ 设备ID 57A4
+ 制造商 AMD
+ 制造商ID 1022
+ 类别 Bridge / PCI to PCI
+ 子系统ID 00000000
+
+ 设备 PCI Express 下游交换机端口
+ 设备ID 57A4
+ 制造商 AMD
+ 制造商ID 1022
+ 类别 Bridge / PCI to PCI
+ 子系统ID 00000000
+
+ 设备 PCI Express 下游交换机端口
+ 设备ID 57A4
+ 制造商 AMD
+ 制造商ID 1022
+ 类别 Bridge / PCI to PCI
+ 子系统ID 00000000
+
+ 设备 标准 NVM Express 控制器
+ 设备ID 2263
+ 制造商 Silicon Motion
+ 制造商ID 126F
+ 类别 Storage /
+ 子系统制造商 Silicon Motion
+ 子系统ID 2263126F
+
+ 设备 RTL8168/8111/8112 Gigabit Ethernet Controller
+ 设备ID 8168
+ 制造商 Realtek
+ 制造商ID 10EC
+ 类别 Network / Ethernet
+ 子系统制造商 ASUSTeK
+ 子系统ID 86771043
+
+ 设备 PCI
+ 设备ID 1485
+ 制造商 AMD
+ 制造商ID 1022
+ 类别 /
+ 子系统制造商 ASUSTeK
+ 子系统ID 87C01043
+
+ 设备 符合 USB xHCI 的主机控制器
+ 设备ID 149C
+ 制造商 AMD
+ 制造商ID 1022
+ 类别 Serial / USB (UHCI)
+ 子系统制造商 ASUSTeK
+ 子系统ID 87C01043
+
+ 设备 符合 USB xHCI 的主机控制器
+ 设备ID 149C
+ 制造商 AMD
+ 制造商ID 1022
+ 类别 Serial / USB (UHCI)
+ 子系统制造商 AMD
+ 子系统ID 148C1022
+
+ 设备 标准 SATA AHCI 控制器
+ 设备ID 7901
+ 制造商 AMD
+ 制造商ID 1022
+ 类别 Storage / Serial ATA (AHCI 1.0)
+ 子系统制造商 AMD
+ 子系统ID 79011022
+
+ 设备 标准 SATA AHCI 控制器
+ 设备ID 7901
+ 制造商 AMD
+ 制造商ID 1022
+ 类别 Storage / Serial ATA (AHCI 1.0)
+ 子系统制造商 AMD
+ 子系统ID 79011022
+
+ 设备 GeForce RTX 2080 Ti
+ 设备ID 1E04
+ 制造商 Nvidia
+ 制造商ID 10DE
+ 类别 Display / VGA
+ 子系统制造商 Colorful
+ 子系统ID 16507377
+
+ 设备 High Definition Audio 控制器
+ 设备ID 10F7
+ 制造商 Nvidia
+ 制造商ID 10DE
+ 类别 Multimedia / Hi-definition Audio
+ 子系统制造商 Colorful
+ 子系统ID 16507377
+
+ 设备 USB 3.10 可扩展主机控制器 - 1.10 (Microsoft)
+ 设备ID 1AD6
+ 制造商 Nvidia
+ 制造商ID 10DE
+ 类别 Serial / USB (UHCI)
+ 子系统制造商 Colorful
+ 子系统ID 16507377
+
+ 设备 USB Type-C Port Policy Controller
+ 设备ID 1AD7
+ 制造商 Nvidia
+ 制造商ID 10DE
+ 类别 Serial / Other
+ 子系统制造商 Colorful
+ 子系统ID 16507377
+
+ 设备 PCI
+ 设备ID 148A
+ 制造商 AMD
+ 制造商ID 1022
+ 类别 /
+ 子系统制造商 ASUSTeK
+ 子系统ID 87C01043
+
+ 设备 PCI
+ 设备ID 1485
+ 制造商 AMD
+ 制造商ID 1022
+ 类别 /
+ 子系统制造商 ASUSTeK
+ 子系统ID 87C01043
+
+ 设备 PSP 11.0 Device
+ 设备ID 1486
+ 制造商 AMD
+ 制造商ID 1022
+ 类别 En/Decryption / Other
+ 子系统制造商 ASUSTeK
+ 子系统ID 87C01043
+
+ 设备 符合 USB xHCI 的主机控制器
+ 设备ID 149C
+ 制造商 AMD
+ 制造商ID 1022
+ 类别 Serial / USB (UHCI)
+ 子系统制造商 ASUSTeK
+ 子系统ID 87C01043
+
+ 设备 High Definition Audio 控制器
+ 设备ID 1487
+ 制造商 AMD
+ 制造商ID 1022
+ 类别 Multimedia / Hi-definition Audio
+ 子系统制造商 ASUSTeK
+ 子系统ID 87BB1043
+
+
+
+
+ --------[ USB设备 ]-------------------------------------------------------------------------------
+
+
+
+
+ 制造商ID 18F8
+ 产品ID 1286
+ 类别 0 / 0 / 0
+ 设备 ? USB GAMING MOUSE
+ Serial ?
+ 版本 USB 1.1
+
+ 制造商ID 0BDA
+ 产品ID 8179
+ 类别 0 / 0 / 0
+ 设备 Realtek 802.11n NIC
+ Serial 00E04C0001
+ 版本 USB 2.0
+
+ 制造商ID 0C45
+ 产品ID 6510
+ 类别 0 / 0 / 0
+ 设备 SONiX USB DEVICE
+ Serial ?
+ 版本 USB 2.0
+
+ 制造商ID 0B05
+ 产品ID 18F3
+ 类别 0 / 0 / 0
+ 设备 AsusTek Computer Inc. AURA LED Controller
+ Serial 9876543210
+ 版本 USB 2.0
+
+
+
+
+ --------[ 传感器 ]--------------------------------------------------------------------------------
+
+
+
+
+ 名称 WINBOND NCT6798D
+ CPU温度 73℃
+ CPU核心 74℃
+ 主板 36℃
+ 显卡 58℃
+ 硬盘温度 42℃
+ 风扇 1050转
+
+
-
+
-
+
-
-
-
-
-
-
@@ -830,16 +907,16 @@
-
-
+
-
+
diff --git a/TextLocator/MainWindow.xaml.cs b/TextLocator/MainWindow.xaml.cs
index e4e4133ac795ddeb98fd002eff362933d510e34a..746d58a6232d28ba7f9ce7841df74c5e379ae80f 100644
--- a/TextLocator/MainWindow.xaml.cs
+++ b/TextLocator/MainWindow.xaml.cs
@@ -23,13 +23,14 @@ using TextLocator.HotKey;
using TextLocator.Index;
using TextLocator.Message;
using TextLocator.Util;
+using TextLocator.ViewModel.Main;
namespace TextLocator
{
///
/// MainWindow.xaml 的交互逻辑
///
- public partial class MainWindow : Window, INotifyPropertyChanged
+ public partial class MainWindow : Window
{
private static readonly ILog log = LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
@@ -46,10 +47,6 @@ namespace TextLocator
///
private Entity.SearchParam _searchParam;
///
- /// 上次预览区搜索文本
- ///
- private string _lastPreviewSearchText;
- ///
/// 索引构建中
///
private static volatile bool build = false;
@@ -59,6 +56,11 @@ namespace TextLocator
///
private WindowState _windowState = WindowState.Normal;
+ ///
+ /// 数据模型
+ ///
+ private MainViewModel _viewModel = new MainViewModel();
+
#region 热键
///
/// 当前窗口句柄
@@ -70,9 +72,11 @@ namespace TextLocator
private Dictionary _hotKeySettings = new Dictionary();
#endregion
+
public MainWindow()
{
InitializeComponent();
+ this.DataContext = _viewModel;
}
#region 窗口初始化
@@ -316,7 +320,7 @@ namespace TextLocator
if (string.IsNullOrEmpty(failList))
return true;
- var result = await MessageCore.Confirm(string.Format("无法注册下列快捷键:\r\n\r\n{0}是否要改变这些快捷键?", failList), "确认提示", MessageBoxButton.YesNo);
+ var result = await MessageCore.ShowMessageBox(string.Format("无法注册下列快捷键:\r\n\r\n{0}是否要改变这些快捷键?", failList), "确认提示", MessageBoxButton.YesNo);
// 弹出热键设置窗体
var win = HotkeyWindow.CreateInstance();
if (result == MessageBoxResult.Yes)
@@ -397,7 +401,7 @@ namespace TextLocator
}
#endregion
- #region 搜索
+ #region 关键词搜索
///
/// 搜索
///
@@ -433,7 +437,7 @@ namespace TextLocator
}
///
- /// 回车搜索
+ /// 关键词文本框回车搜索
///
///
///
@@ -480,6 +484,74 @@ namespace TextLocator
SearchTextBorder.BorderBrush = new SolidColorBrush(this.SearchText.Text.Length > 0 ? Colors.Green : (Color)ColorConverter.ConvertFromString("#2196f3"));
}
+ ///
+ /// 搜索前
+ ///
+ /// 指定页
+ private void BeforeSearch(int page = 1)
+ {
+ // 1、---- 搜索信息预处理
+ // 还原分页count
+ if (page != _viewModel.PageIndex)
+ {
+ _viewModel.PageIndex = page;
+ // 设置分页标签总条数
+ _viewModel.TotalCount = 0;
+ }
+
+ // 获取搜索关键词列表
+ List keywords = GetSearchTextKeywords();
+ if (keywords.Count <= 0)
+ {
+ return;
+ }
+
+
+ // 2、---- 预览信息还原
+ // 预览区打开文件和文件夹标记清空
+ OpenFile.Tag = null;
+ OpenFolder.Tag = null;
+
+ // 预览文件名清空
+ PreviewFileName.Text = "";
+
+ // 预览文件内容清空
+ PreviewFileContent.Document = null;
+
+ // 预览图标清空
+ PreviewImage.Source = null;
+
+ // 预览文件类型图标清空
+ PreviewFileTypeIcon.Source = null;
+
+ // 预览切换标记清空
+ SwitchPreview.Tag = null;
+
+
+ // 3、---- 生成本次搜索时间戳
+ _timestamp = Convert.ToInt64((DateTime.Now - new DateTime(1970, 1, 1, 0, 0, 0, 0)).TotalMilliseconds);
+
+
+ // 4、---- 构造搜索条件并保存(保存的搜索条件需要用于数据导出)
+ _searchParam = new Entity.SearchParam()
+ {
+ Keywords = keywords,
+ FileType = (FileType)SearchFileType.Tag,
+ SortType = (SortType)SortOptions.SelectedValue,
+ IsPreciseRetrieval = (bool)PreciseRetrieval.IsChecked,
+ IsMatchWords = (bool)MatchWords.IsChecked,
+ SearchRegion = (SearchRegion)SearchScope.SelectedValue,
+ PageSize = _viewModel.PageSize,
+ PageIndex = _viewModel.PageIndex
+ };
+
+ // 5、---- 搜索
+ Search(
+ _timestamp,
+ _searchParam
+ );
+ }
+
///
/// 搜索
///
@@ -499,10 +571,10 @@ namespace TextLocator
try
{
// 1、---- 清空搜索结果列表
- Dispatcher.Invoke(new Action(() =>
+ Dispatcher.Invoke(() =>
{
this.SearchResultList.Items.Clear();
- }));
+ });
// 2、---- 查询列表(参数,消息回调)
Entity.SearchResult searchResult = IndexCore.Search(searchParam, ShowStatus);
@@ -510,10 +582,7 @@ namespace TextLocator
// 验证列表数据
if (null == searchResult || searchResult.Results.Count <= 0)
{
- this.Dispatcher.BeginInvoke(new Action(() =>
- {
- MessageCore.ShowWarning("没有搜到你想要的内容,请更换搜索条件。");
- }));
+ MessageCore.ShowWarning("没有搜到你想要的内容,请更换搜索条件。");
return;
}
@@ -524,27 +593,18 @@ namespace TextLocator
{
return;
}
- this.Dispatcher.Invoke(new Action(() =>
+ Dispatcher.Invoke(() =>
{
this.SearchResultList.Items.Add(new FileInfoItem(fileInfo, searchParam.SearchRegion));
- }));
+ });
}
// 4、---- 显示预览列表分页信息
- Dispatcher.Invoke(new Action(() =>
- {
- this.PreviewPage.Text = string.Format("0/{0}", SearchResultList.Items.Count);
- }));
+ _viewModel.PreviewPage = string.Format("0/{0}", searchResult.Results.Count);
// 5、---- 分页总数
- this.Dispatcher.BeginInvoke(new Action(() =>
- {
- // 如果总条数小于等于分页条数,则不显示分页
- this.PageBar.Total = searchResult.Total > PageSize ? searchResult.Total : 0;
-
- // 上一个和下一个切换面板是否显示
- this.SwitchPreview.Visibility = searchResult.Total > 0 ? Visibility.Visible : Visibility.Hidden;
- }));
+ _viewModel.TotalCount = searchResult.Total;
+ _viewModel.PreviewSwitchVisibility = searchResult.Total > 0 ? Visibility.Visible : Visibility.Hidden;
}
catch (Exception ex)
{
@@ -556,38 +616,7 @@ namespace TextLocator
}
#endregion
- #region 分页
- ///
- /// 当前页
- ///
- public int PageNow = 1;
- ///
- /// 实现INotifyPropertyChanged接口
- ///
- public event PropertyChangedEventHandler PropertyChanged;
- public void OnPropertyChanged(string propertyName)
- {
- if (this.PropertyChanged != null)
- {
- this.PropertyChanged.Invoke(this, new PropertyChangedEventArgs(propertyName));
- }
- }
- ///
- /// 每页显示数量
- ///
- public int PageSize
- {
- // 获取值时将私有字段传出;
- get { return AppConst.MRESULT_LIST_PAGE_SIZE; }
- set
- {
- // 赋值时将值传给私有字段
- AppConst.MRESULT_LIST_PAGE_SIZE = value;
- // 一旦执行了赋值操作说明其值被修改了,则立马通过INotifyPropertyChanged接口告诉UI(IntValue)被修改了
- OnPropertyChanged("PageSize");
- }
- }
-
+ #region 数据分页
// 切换页码
private void PageBar_PageIndexChanged(object sender, RoutedPropertyChangedEventArgs e)
{
@@ -599,10 +628,12 @@ namespace TextLocator
private void PageBar_PageSizeChanged(object sender, RoutedPropertyChangedEventArgs e)
{
log.Debug($"pageSize : {e.OldValue} => {e.NewValue}");
+
+ _viewModel.PageSize = e.NewValue;
}
#endregion
- #region 排序
+ #region 列表排序
///
/// 排序选中
///
@@ -610,11 +641,11 @@ namespace TextLocator
///
private void SortOptions_SelectionChanged(object sender, SelectionChangedEventArgs e)
{
- BeforeSearch(PageNow);
+ BeforeSearch(_viewModel.PageIndex);
}
#endregion
- #region 清空
+ #region 结果清空
///
/// 清空按钮
///
@@ -659,24 +690,15 @@ namespace TextLocator
SearchResultList.Items.Clear();
// -------- 右侧预览区
- // 清空预览搜索框
- PreviewSearchText.Text = "";
- _lastPreviewSearchText = "";
-
// 右侧预览区,打开文件和文件夹标记清空
OpenFile.Tag = null;
OpenFolder.Tag = null;
- // 滚动条回滚到最顶端
- PreviewFileContent.ScrollToHome();
- // 滚动条回滚到最顶端(图片)
- // PreviewImageScrollViewer.ScrollToHome();
-
// 预览文件名清空
PreviewFileName.Text = "";
// 预览文件内容清空
- PreviewFileContent.Document.Blocks.Clear();
+ PreviewFileContent.Document = null;
// 预览图片清空
PreviewImage.Source = null;
@@ -686,31 +708,24 @@ namespace TextLocator
// -------- 分页标签
// 还原为第一页
- PageNow = 1;
+ _viewModel.PageIndex = 1;
// 设置分页标签总条数
- this.Dispatcher.BeginInvoke(new Action(() =>
- {
- this.PageBar.Total = 0;
- this.PageBar.PageIndex = 1;
- }));
+ _viewModel.TotalCount = 0;
// -------- 快捷标签
// 隐藏上一个和下一个切换面板
this.SwitchPreview.Visibility = Visibility.Collapsed;
- // 预览文件内容分页标记
- SwitchPreviewContentPage.Tag = 0;
- SwitchPreviewContentPage.Visibility = Visibility.Collapsed;
// -------- 搜索参数
_searchParam = null;
// -------- 状态栏
// 工作状态更新为就绪
- WorkStatus.Text = "就绪";
+ ShowStatus("就绪");
}
#endregion
- #region 列表
+ #region 数据列表
///
/// 列表项被选中事件
///
@@ -726,7 +741,7 @@ namespace TextLocator
// 预览切换索引标记
this.SwitchPreview.Tag = SearchResultList.SelectedIndex;
// 显示预览分页信息
- this.PreviewPage.Text = String.Format("{0}/{1}", this.SearchResultList.SelectedIndex + 1, SearchResultList.Items.Count);
+ _viewModel.PreviewPage = String.Format("{0}/{1}", this.SearchResultList.SelectedIndex + 1, SearchResultList.Items.Count);
// 手动GC
GC.Collect();
@@ -738,23 +753,18 @@ namespace TextLocator
// 根据文件类型显示图标
PreviewFileTypeIcon.Source = FileUtil.GetFileIcon(fileInfo.FileType);
PreviewFileName.Text = fileInfo.FileName;
- PreviewFileContent.Document.Blocks.Clear();
+ PreviewFileContent.Document = null;
// 绑定打开文件和打开路径的Tag
OpenFile.Tag = fileInfo.FilePath;
OpenFolder.Tag = fileInfo.FilePath.Substring(0, fileInfo.FilePath.LastIndexOf("\\"));
- // 滚动条回滚到最顶端
- PreviewFileContent.ScrollToHome();
- // 滚动条回滚到最顶端(图片)
- // PreviewImageScrollViewer.ScrollToHome();
-
// 图片文件
if (FileType.常用图片 == FileTypeUtil.GetFileType(fileInfo.FilePath))
{
PreviewFileContent.Visibility = Visibility.Hidden;
PreviewImage.Visibility = Visibility.Visible;
- Thread t = new Thread(new ThreadStart(() =>
+ Task.Factory.StartNew(() =>
{
try
{
@@ -765,55 +775,54 @@ namespace TextLocator
bi.EndInit();
bi.Freeze();
- Dispatcher.BeginInvoke(new Action(() =>
+ Dispatcher.InvokeAsync(() =>
{
PreviewImage.Source = bi;
- }));
+ });
}
catch (Exception ex)
{
log.Error(ex.Message, ex);
try
{
- Dispatcher.BeginInvoke(new Action(() =>
+ Dispatcher.InvokeAsync(() =>
{
PreviewImage.Source = null;
- }));
+ });
}
catch { }
}
- }));
- t.Priority = ThreadPriority.AboveNormal;
- t.Start();
+ });
}
else
{
PreviewImage.Visibility = Visibility.Hidden;
PreviewFileContent.Visibility = Visibility.Visible;
- // 标记当前页
- SwitchPreviewContentPage.Tag = 0;
- // 填充数据
- RichTextBoxUtil.EmptyData(PreviewFileContent);
// 文件内容预览
- Thread t = new Thread(() =>
+ Task.Factory.StartNew(() =>
{
try
{
// 文件内容(预览)FileInfoServiceFactory.GetFileContent(fileInfo.FilePath, true);
string content = fileInfo.Preview;
- // 内容预览分页
- List previewList = SplitContent(content);
- // 缓存预览列表,关键词列表,是否区分大小写
- CacheUtil.Put(AppConst.CacheKey.PREVIEW_CONTENT_SPLIT_LIST_KEY, previewList);
- CacheUtil.Put(AppConst.CacheKey.PREVIEW_FILE_INFO_KEYWORDS_KEY, fileInfo.Keywords);
Dispatcher.InvokeAsync(() =>
{
-
- PreviewRefresh(previewList, 0);
-
- // 显示或隐藏操作按钮
- SwitchPreviewContentPage.Visibility = previewList.Count > 1 ? Visibility.Visible : Visibility.Collapsed;
+ // 填充数据
+ FileContentUtil.FillFlowDocument(PreviewFileContent, content, new SolidColorBrush(Colors.Black));
+ // 默认滚动到第一页
+ PreviewFileContent.CanGoToPage(1);
+ ScrollViewer sourceScrollViewer = PreviewFileContent.Template.FindName("PART_ContentHost", PreviewFileContent) as ScrollViewer;
+ if (sourceScrollViewer != null)
+ {
+ sourceScrollViewer.ScrollToTop();
+ }
+ // 关键词高亮
+ FileContentUtil.FlowDocumentHighlight(
+ PreviewFileContent,
+ Colors.Red,
+ fileInfo.Keywords
+ );
});
}
catch (Exception ex)
@@ -821,82 +830,11 @@ namespace TextLocator
log.Error(ex.Message, ex);
}
});
- t.Priority = ThreadPriority.Highest;
- t.Start();
}
}
-
- ///
- /// 分隔内容
- ///
- ///
- ///
- private List SplitContent(string content)
- {
- int limit = AppConst.FILE_PREVIEW_LEN_LIMIT;
- int lenth = content.Length;
- List splitList = new List();
- if (lenth < limit)
- {
- splitList.Add(content);
- }
- else
- {
- int splitLenth = lenth / limit;
- for (int i = 0; i < splitLenth; i++)
- {
- splitList.Add(content.Substring(limit * i, limit));
- }
- if (lenth % limit != 0)
- {
- splitList.Add(content.Substring(limit * splitLenth));
- }
- }
- return splitList;
- }
-
- ///
- /// 刷新预览
- ///
- /// 预览内容列表
- /// 当前页
- private void PreviewRefresh(List previewList, int page)
- {
- string preview = previewList[page];
- // 填充数据
- RichTextBoxUtil.FillingData(PreviewFileContent, preview, new SolidColorBrush(Colors.Black));
-
- // 显示分页信息
- PreviewContentPage.Text = string.Format("{0}/{1}", page + 1, previewList.Count);
-
- // 滚动条回滚到最顶端
- PreviewFileContent.ScrollToHome();
- // 滚动条回滚到最顶端(图片)
- // PreviewImageScrollViewer.ScrollToHome();
-
- // 获取文件名
- string fileName = PreviewFileName.Text;
- Task.Factory.StartNew(() => {
- int matchCount = IndexCore.GetMatchCount(new Entity.FileInfo()
- {
- SearchRegion = SearchRegion.文件名和内容,
- FileName = fileName,
- Preview = preview,
- });
- Dispatcher.InvokeAsync(async () =>
- {
- // 关键词高亮
- RichTextBoxUtil.Highlighted(
- PreviewFileContent,
- Colors.Red,
- CacheUtil.Get>(AppConst.CacheKey.PREVIEW_FILE_INFO_KEYWORDS_KEY)
- );
- });
- });
- }
#endregion
- #region 界面事件
+ #region 功能事件
///
/// 搜索域切换事件
@@ -971,7 +909,7 @@ namespace TextLocator
}
if (CheckIndexExist(false))
{
- var result = await MessageCore.Confirm("确定要重建索引嘛?时间可能比较久哦!", "确认提示");
+ var result = await MessageCore.ShowMessageBox("确定要重建索引嘛?时间可能比较久哦!", "确认提示");
if (result == MessageBoxResult.Cancel)
{
return;
@@ -1056,51 +994,7 @@ namespace TextLocator
}
// 显示分页信息
- this.PreviewPage.Text = String.Format("{0}/{1}", this.SearchResultList.SelectedIndex + 1, SearchResultList.Items.Count);
- }
-
- ///
- /// 预览内容上一页
- ///
- ///
- ///
- private void BtnLastPage_MouseUp(object sender, MouseButtonEventArgs e)
- {
- // 获取列表
- List previewList = CacheUtil.Get>(AppConst.CacheKey.PREVIEW_CONTENT_SPLIT_LIST_KEY);
- if (previewList != null)
- {
- // 获取当前页
- int page = (int)SwitchPreviewContentPage.Tag;
- if (page > 0)
- {
- page = page - 1;
- SwitchPreviewContentPage.Tag = page;
- }
- PreviewRefresh(previewList, page);
- }
- }
-
- ///
- /// 预览内容下一页
- ///
- ///
- ///
- private void BtnNextPage_MouseUp(object sender, MouseButtonEventArgs e)
- {
- // 获取列表
- List previewList = CacheUtil.Get>(AppConst.CacheKey.PREVIEW_CONTENT_SPLIT_LIST_KEY);
- if (previewList != null)
- {
- // 获取当前页
- int page = (int)SwitchPreviewContentPage.Tag;
- if (page < previewList.Count - 1)
- {
- page = page + 1;
- SwitchPreviewContentPage.Tag = page;
- }
- PreviewRefresh(previewList, page);
- }
+ _viewModel.PreviewPage = String.Format("{0}/{1}", this.SearchResultList.SelectedIndex + 1, SearchResultList.Items.Count);
}
#endregion
@@ -1309,11 +1203,7 @@ namespace TextLocator
log.Info(msg);
ShowStatus(msg);
- Dispatcher.BeginInvoke(new Action(() =>
- {
- MessageCore.ShowSuccess(msg);
- }));
-
+ MessageCore.ShowSuccess(msg);
// 2.8、-------- 记录文件总数、更新总数、删除总数、错误总数
fileTotalCount = fileTotalCount + allFilePaths.Count;
@@ -1349,27 +1239,26 @@ namespace TextLocator
/// 进度,0-100
private void ShowStatus(string text, double percent = AppConst.MAX_PERCENT)
{
- void refresh()
+ void Refresh()
{
WorkStatus.Text = text;
+ TaskbarInfo.ProgressState = percent < AppConst.MAX_PERCENT ? System.Windows.Shell.TaskbarItemProgressState.Normal : System.Windows.Shell.TaskbarItemProgressState.None;
if (percent > AppConst.MIN_PERCENT)
{
WorkProgress.Value = percent;
-
- TaskbarItemInfo.ProgressState = percent < AppConst.MAX_PERCENT ? System.Windows.Shell.TaskbarItemProgressState.Normal : System.Windows.Shell.TaskbarItemProgressState.None;
- TaskbarItemInfo.ProgressValue = WorkProgress.Value / WorkProgress.Maximum;
+ TaskbarInfo.ProgressValue = percent / 100;
}
}
try
{
- refresh();
+ Refresh();
}
catch
{
- Dispatcher.BeginInvoke(new Action(() =>
+ Dispatcher.InvokeAsync(() =>
{
- refresh();
- }));
+ Refresh();
+ });
}
}
#endregion
@@ -1417,105 +1306,6 @@ namespace TextLocator
}
#endregion
- #region 预览文本搜索
- ///
- /// 预览搜索文本框内容改变
- ///
- ///
- ///
- private void PreviewSearchText_TextChanged(object sender, TextChangedEventArgs e)
- {
- string text = PreviewSearchText.Text.Trim();
- PreviewCleanButton.Visibility = text.Length > 0 ? Visibility.Visible : Visibility.Hidden;
- }
-
- ///
- /// 预览搜索清空按钮
- ///
- ///
- ///
- private void PreviewCleanButton_Click(object sender, RoutedEventArgs e)
- {
- // 清理上一次的搜索关键词
- if (!string.IsNullOrEmpty(_lastPreviewSearchText))
- {
- List keywords = _lastPreviewSearchText.Split(' ').ToList();
- Task.Factory.StartNew(() =>
- {
- Dispatcher.Invoke(new Action(() =>
- {
- // 关键词高亮
- RichTextBoxUtil.Highlighted(PreviewFileContent, Colors.White, keywords, true);
- }));
- });
- _lastPreviewSearchText = "";
- }
-
- // 清理文本框
- PreviewSearchText.Text = "";
- }
- ///
- /// 预览搜索文本搜索按钮
- ///
- ///
- ///
- private void PreviewSearchButton_Click(object sender, RoutedEventArgs e)
- {
- // 预览搜索关键词高亮
- PreviewSearchTextHighlighted();
- }
-
- ///
- /// 预览搜索关键词高亮
- ///
- private void PreviewSearchTextHighlighted()
- {
- // 搜索关键词
- string text = PreviewSearchText.Text.Trim();
-
- // 清理上一次的搜索关键词(上一次搜索关键词不为空 && 和本次搜索关键词不相同才清理)
- if (!string.IsNullOrEmpty(_lastPreviewSearchText) && !_lastPreviewSearchText.Equals(text))
- {
- List keywords = _lastPreviewSearchText.Split(' ').ToList();
- Task.Factory.StartNew(() => {
- Dispatcher.BeginInvoke(new Action(() =>
- {
- // 关键词高亮
- RichTextBoxUtil.Highlighted(PreviewFileContent, Colors.White, keywords, true);
- }));
- });
- }
-
- if (!string.IsNullOrEmpty(text))
- {
- _lastPreviewSearchText = text;
-
- List keywords = text.Split(' ').ToList();
- Task.Factory.StartNew(() => {
- Dispatcher.BeginInvoke(new Action(() =>
- {
- // 关键词高亮
- RichTextBoxUtil.Highlighted(PreviewFileContent, Colors.DeepSkyBlue, keywords, true);
- }));
- });
- }
- }
-
- ///
- /// 预览搜索文本按键
- ///
- ///
- ///
- private void PreviewSearchText_PreviewKeyUp(object sender, KeyEventArgs e)
- {
- if (e.Key == Key.Enter)
- {
- // 预览搜索关键词高亮
- PreviewSearchTextHighlighted();
- }
- }
- #endregion
-
#region 其他私有封装
///
/// 获取文本关键词
@@ -1524,9 +1314,6 @@ namespace TextLocator
private List GetSearchTextKeywords()
{
string searchText = SearchText.Text.Trim();
-
- // 清理特殊字符
-
// 申明关键词列表
List keywords = new List();
// 为空直接返回null
@@ -1535,7 +1322,7 @@ namespace TextLocator
// 精确检索未选中
if (PreciseRetrieval.IsChecked == false)
{
- // 替换内置关键词
+ // 替换内置(AND|OR|NOT|\\&\\&|\\|\\||\"|\\~|\\:)特殊字符
searchText = AppConst.REGEX_BUILT_IN_SYMBOL.Replace(searchText, " ");
}
@@ -1552,105 +1339,28 @@ namespace TextLocator
keywords.Add(keyword);
}
}
- else
+ // 精确检索
+ else if (PreciseRetrieval.IsChecked == true)
{
- // 精确检索
- if (PreciseRetrieval.IsChecked == true)
- {
- keywords.Add(searchText);
- }
- // 通配符 || 内置字符(AND|OR|NOT)
- else if (AppConst.REGEX_SUPPORT_WILDCARDS.IsMatch(searchText))
- {
- keywords.Add(searchText);
- }
- // 分词器分词
- else
- {
- // 分词列表
- List segmentList = AppConst.INDEX_SEGMENTER.CutForSearch(searchText).ToList();
- // 合并关键列表
- keywords = keywords.Union(segmentList).ToList();
- }
+ keywords.Add(searchText);
}
- return keywords;
- }
-
- ///
- /// 搜索前
- ///
- /// 指定页
- private void BeforeSearch(int page = 1)
- {
- // 1、---- 搜索信息预处理
- // 还原分页count
- if (page != PageNow)
+ // 正则表达式
+ else if (AppConst.REGEX_JUDGMENT.IsMatch(searchText))
{
- PageNow = page;
- // 设置分页标签总条数
- this.Dispatcher.BeginInvoke(new Action(() =>
- {
- this.PageBar.Total = 0;
- this.PageBar.PageIndex = PageNow;
- }));
+ keywords.Add(searchText);
}
-
- // 获取搜索关键词列表
- List keywords = GetSearchTextKeywords();
- if (keywords.Count <= 0)
+ // 分词器自动分词
+ else
{
- return;
+ // 分词列表
+ List segmentList = AppConst.INDEX_SEGMENTER.CutForSearch(searchText).ToList();
+ // 合并关键列表
+ keywords = keywords.Union(segmentList).ToList();
}
-
-
- // 2、---- 预览信息还原
- // 预览区打开文件和文件夹标记清空
- OpenFile.Tag = null;
- OpenFolder.Tag = null;
-
- // 预览文件名清空
- PreviewFileName.Text = "";
-
- // 预览文件内容清空
- PreviewFileContent.Document.Blocks.Clear();
-
- // 预览文件内容分页标记
- SwitchPreviewContentPage.Tag = 0;
- SwitchPreviewContentPage.Visibility = Visibility.Collapsed;
-
- // 预览图标清空
- PreviewImage.Source = null;
-
- // 预览文件类型图标清空
- PreviewFileTypeIcon.Source = null;
-
- // 预览切换标记清空
- SwitchPreview.Tag = null;
-
-
- // 3、---- 生成本次搜索时间戳
- _timestamp = Convert.ToInt64((DateTime.Now - new DateTime(1970, 1, 1, 0, 0, 0, 0)).TotalMilliseconds);
-
-
- // 4、---- 构造搜索条件并保存(保存的搜索条件需要用于数据导出)
- _searchParam = new Entity.SearchParam()
- {
- Keywords = keywords,
- FileType = (FileType)SearchFileType.Tag,
- SortType = (SortType)SortOptions.SelectedValue,
- IsPreciseRetrieval = (bool) PreciseRetrieval.IsChecked,
- IsMatchWords = (bool)MatchWords.IsChecked,
- SearchRegion = (SearchRegion)SearchScope.SelectedValue,
- PageSize = PageSize,
- PageIndex = PageNow
- };
-
- // 5、---- 搜索
- Search(
- _timestamp,
- _searchParam
- );
+ return keywords;
}
+
+
#endregion
}
}
diff --git a/TextLocator/Message/MessageCore.cs b/TextLocator/Message/MessageCore.cs
index fac0291d2f5281da7499950092e8f68fe6eb15fe..cbdc15d118b728032afaf2a69a068497f1027cf1 100644
--- a/TextLocator/Message/MessageCore.cs
+++ b/TextLocator/Message/MessageCore.cs
@@ -1,5 +1,6 @@
using System.Threading.Tasks;
using System.Windows;
+using System.Windows.Threading;
using TextLocator.Core;
namespace TextLocator.Message
@@ -16,15 +17,29 @@ namespace TextLocator.Message
///
/// Rubyer.MessageBoxR参数containerIdentifier
///
- private const string CONFIRM_CONTAINER = "ConfirmContainers";
+ private const string MESSAGE_BOX_CONTAINER = "MessageBoxContainers";
///
/// 警告
///
///
public static void ShowWarning(string message)
- {
- Rubyer.Message.ShowWarning(MESSAGE_CONTAINER, message);
+ {
+ void TryShow()
+ {
+ Rubyer.Message.ShowWarning(MESSAGE_CONTAINER, message);
+ }
+ try
+ {
+ TryShow();
+ }
+ catch
+ {
+ Dispatcher.CurrentDispatcher.InvokeAsync(() =>
+ {
+ TryShow();
+ });
+ }
}
///
@@ -33,7 +48,21 @@ namespace TextLocator.Message
///
public static void ShowSuccess(string message)
{
- Rubyer.Message.ShowSuccess(MESSAGE_CONTAINER, message);
+ void TryShow()
+ {
+ Rubyer.Message.ShowSuccess(MESSAGE_CONTAINER, message);
+ }
+ try
+ {
+ TryShow();
+ }
+ catch
+ {
+ Dispatcher.CurrentDispatcher.InvokeAsync(() =>
+ {
+ TryShow();
+ });
+ }
}
///
@@ -42,7 +71,21 @@ namespace TextLocator.Message
///
public static void ShowError(string message)
{
- Rubyer.Message.ShowError(MESSAGE_CONTAINER, message);
+ void TryShow()
+ {
+ Rubyer.Message.ShowError(MESSAGE_CONTAINER, message);
+ }
+ try
+ {
+ TryShow();
+ }
+ catch
+ {
+ Dispatcher.CurrentDispatcher.InvokeAsync(() =>
+ {
+ TryShow();
+ });
+ }
}
///
@@ -51,7 +94,21 @@ namespace TextLocator.Message
///
public static void ShowInfo(string message)
{
- Rubyer.Message.ShowInfo(MESSAGE_CONTAINER, message);
+ void TryShow()
+ {
+ Rubyer.Message.ShowInfo(MESSAGE_CONTAINER, message);
+ }
+ try
+ {
+ TryShow();
+ }
+ catch
+ {
+ Dispatcher.CurrentDispatcher.InvokeAsync(() =>
+ {
+ TryShow();
+ });
+ }
}
///
@@ -61,9 +118,9 @@ namespace TextLocator.Message
///
///
///
- public static Task Confirm(string message, string title, MessageBoxButton button = MessageBoxButton.OKCancel)
+ public static Task ShowMessageBox(string message, string title, MessageBoxButton button = MessageBoxButton.OKCancel)
{
- return Rubyer.MessageBoxR.ConfirmInContainer(CONFIRM_CONTAINER, message, title, button);
+ return Rubyer.MessageBoxR.ConfirmInContainer(MESSAGE_BOX_CONTAINER, message, title, button);
}
}
}
diff --git a/TextLocator/Properties/AssemblyInfo.cs b/TextLocator/Properties/AssemblyInfo.cs
index 79b42ca4e8767e1ae23b6b9f51298ab4b385ed4c..a777f27d01d1e6e2eecfe7f2087f08bddcbe306a 100644
--- a/TextLocator/Properties/AssemblyInfo.cs
+++ b/TextLocator/Properties/AssemblyInfo.cs
@@ -50,9 +50,9 @@ using System.Windows;
//通过使用 "*",如下所示:
// [assembly: AssemblyVersion("1.0.*")]
// 大版本,强制更新最小版本
-[assembly: AssemblyVersion("2.1.18")]
+[assembly: AssemblyVersion("2.1.20")]
// 小版本,选择更新版本
-[assembly: AssemblyFileVersion("2.1.18.1")]
+[assembly: AssemblyFileVersion("2.1.20.1")]
// Version minVersion = System.Reflection.Assembly.GetExecutingAssembly().GetName().Version;
// Version version = new Version(FileVersionInfo.GetVersionInfo(System.Windows.Forms.Application.ExecutablePath).ProductVersion);
diff --git a/TextLocator/TextLocator.csproj b/TextLocator/TextLocator.csproj
index fb08412bc09fc13b0cbca6026fd954b810ef4d07..d9057dd033e55fb624d3e6efe274bf0e484d7280 100644
--- a/TextLocator/TextLocator.csproj
+++ b/TextLocator/TextLocator.csproj
@@ -344,7 +344,10 @@
-
+
+
+
+
Designer
MSBuild:Compile
@@ -485,5 +488,6 @@
+
\ No newline at end of file
diff --git a/TextLocator/Util/RichTextBoxUtil.cs b/TextLocator/Util/FileContentUtil.cs
similarity index 43%
rename from TextLocator/Util/RichTextBoxUtil.cs
rename to TextLocator/Util/FileContentUtil.cs
index b3c0fec6438299896ea838cd202dc4724bb927db..e0f868ac3c866a5916c5b5bf8031ec83cbebdde5 100644
--- a/TextLocator/Util/RichTextBoxUtil.cs
+++ b/TextLocator/Util/FileContentUtil.cs
@@ -9,56 +9,72 @@ using TextLocator.Core;
namespace TextLocator.Util
{
- public class RichTextBoxUtil
+ public class FileContentUtil
{
+ #region RichText操作
///
- /// 清空数据
+ /// 清空RichText的Document
///
- /// RichTextBox文本对象
- public static void EmptyData(RichTextBox richTextBox)
+ /// RichTextBox对象
+ public static void EmptyRichTextDocument(RichTextBox richTextBox)
{
richTextBox.Document.Blocks.Clear();
}
///
- /// 填充数据
+ /// 填充FlowDocument内容
///
- /// RichTextBox文本对象
+ /// RichTextBox 或 FlowDocumentReader对象
/// 高亮关键词
/// 高亮颜色画刷
/// 下划线
- public static void FillingData(RichTextBox richTextBox, string text, Brush brush, bool underLine = false)
+ public static void FillFlowDocument(Control control, string text, Brush brush, bool isUnderLine = false)
{
- richTextBox.Document.Blocks.Clear();
// Paragraph 类似于 html 的 P 标签
Paragraph paragraph = new Paragraph();
+ paragraph.FontFamily = new FontFamily("微软雅黑");
+ paragraph.FontSize = 13;
+ paragraph.Foreground = brush;
+ if (isUnderLine)
+ {
+ paragraph.TextDecorations = TextDecorations.Underline;
+ }
// Run 是一个 Inline 的标签
Run run = new Run(text);
- run.Foreground = brush;
- if (underLine)
+ paragraph.Inlines.Add(run);
+ if (control is RichTextBox)
{
- run.TextDecorations = TextDecorations.Underline;
+ (control as RichTextBox).Document = new FlowDocument(paragraph);
+ }
+ else
+ {
+ (control as FlowDocumentReader).Document = new FlowDocument(paragraph);
}
- paragraph.Inlines.Add(run);
- richTextBox.Document.Blocks.Add(paragraph);
}
///
- /// 关键词高亮
+ /// FlowDocument关键词高亮
///
- /// UI元素
+ /// RichTextBox 或 FlowDocumentReader对象
/// 颜色值
/// 关键词
- /// 背景颜色
- public static void Highlighted(RichTextBox richTextBox, Color color, List keywords, bool background = false)
+ /// 背景颜色
+ public static void FlowDocumentHighlight(Control control, Color color, List keywords, bool isBackground = false)
{
if (keywords == null || keywords.Count <= 0) return;
foreach (string keyword in keywords)
{
if (string.IsNullOrEmpty(keyword)) continue;
- // 设置文字指针为Document初始位置
- // richBox.Document.FlowDirection
- TextPointer position = richTextBox.Document.ContentStart;
+ // 设置文字指针为Document初始位置
+ TextPointer position;
+ if (control is RichTextBox)
+ {
+ position = (control as RichTextBox).Document.ContentStart;
+ }
+ else
+ {
+ position = (control as FlowDocumentReader).Document.ContentStart;
+ }
while (position != null)
{
// 向前搜索,需要内容为Text
@@ -66,28 +82,14 @@ namespace TextLocator.Util
{
// 拿出Run的Text
string text = position.GetTextInRun(LogicalDirection.Forward);
- // 关键词是正则表达式
- if (AppConst.REGEX_SUPPORT_WILDCARDS.IsMatch(keyword))
- {
- Regex regex = new Regex(keyword, RegexOptions.IgnoreCase);
- Match matches = regex.Match(text);
- if (matches.Success)
- {
- TextPointer start = position.GetPositionAtOffset(matches.Index);
- TextPointer end = start.GetPositionAtOffset(matches.Length);
- position = Selecta(richTextBox, color, start, end, background);
- }
- }
- else
+ // 关键词匹配查找
+ Regex regex = new Regex(keyword, RegexOptions.IgnoreCase);
+ Match matches = regex.Match(text);
+ if (matches.Success)
{
- // 可能包含多个keyword,做遍历查找
- int index = text.IndexOf(keyword, 0, StringComparison.CurrentCultureIgnoreCase);
- if (index != -1)
- {
- TextPointer start = position.GetPositionAtOffset(index);
- TextPointer end = start.GetPositionAtOffset(keyword.Length);
- position = Selecta(richTextBox, color, start, end, background);
- }
+ TextPointer start = position.GetPositionAtOffset(matches.Index);
+ TextPointer end = start.GetPositionAtOffset(matches.Length);
+ position = Selecta(control, color, start, end, isBackground);
}
}
// 文字指针向前偏移
@@ -97,32 +99,33 @@ namespace TextLocator.Util
}
///
- /// 改变关键字的具体实现
+ /// FlowDocument关键词高亮的具体实现
///
- /// 元素
+ /// RichTextBox 或 FlowDocumentReader对象
/// 颜色
/// 内容指针开始位置
/// 内容指针结束位置
///
- private static TextPointer Selecta(RichTextBox richTextBox, Color color, TextPointer tpStart, TextPointer tpEnd, bool background)
+ private static TextPointer Selecta(Control control, Color color, TextPointer tpStart, TextPointer tpEnd, bool background)
{
- TextRange range = richTextBox.Selection;
- range.Select(tpStart, tpEnd);
-
- //高亮选择
- if (background)
+ TextRange range;
+ if (control is RichTextBox)
{
- range.ApplyPropertyValue(TextElement.BackgroundProperty, new SolidColorBrush(color));
- range.ApplyPropertyValue(TextElement.FontWeightProperty, color == Colors.White ? FontWeights.Normal : FontWeights.Bold);
+ range = (control as RichTextBox).Selection;
}
else
{
- range.ApplyPropertyValue(TextElement.ForegroundProperty, new SolidColorBrush(color));
- range.ApplyPropertyValue(TextElement.FontWeightProperty, FontWeights.Bold);
+ range = (control as FlowDocumentReader).Selection;
}
-
+ range.Select(tpStart, tpEnd);
+
+ // 内容加粗
+ range.ApplyPropertyValue(TextElement.FontWeightProperty, FontWeights.Bold);
+ // 内容高亮
+ range.ApplyPropertyValue(background ? TextElement.BackgroundProperty : TextElement.ForegroundProperty, new SolidColorBrush(color));
return tpEnd.GetNextContextPosition(LogicalDirection.Forward);
}
+ #endregion
}
}
diff --git a/TextLocator/ViewModel/Main/MainModel.cs b/TextLocator/ViewModel/Main/MainModel.cs
new file mode 100644
index 0000000000000000000000000000000000000000..0859022a68625c6106b99c72918fc5f413185ebd
--- /dev/null
+++ b/TextLocator/ViewModel/Main/MainModel.cs
@@ -0,0 +1,35 @@
+using System.Windows;
+
+namespace TextLocator.ViewModel.Main
+{
+ ///
+ /// 主窗口数据Model
+ ///
+ public class MainModel
+ {
+ // ================================ 分页
+ ///
+ /// 当前页
+ ///
+ public int PageIndex { get; set; }
+
+ ///
+ /// 分页条数
+ ///
+ public int PageSize { get; set; }
+
+ ///
+ /// 结果总条数
+ ///
+ public int TotalCount { get; set; }
+
+ ///
+ /// 预览分页
+ ///
+ public string PreviewPage { get; set; }
+ ///
+ /// 切换预览显示状态
+ ///
+ public Visibility PreviewSwitchVisibility { get; set; }
+ }
+}
diff --git a/TextLocator/ViewModel/Main/MainViewModel.cs b/TextLocator/ViewModel/Main/MainViewModel.cs
new file mode 100644
index 0000000000000000000000000000000000000000..8df129bd28fc1708c00ccb7654609eb1e568bc1f
--- /dev/null
+++ b/TextLocator/ViewModel/Main/MainViewModel.cs
@@ -0,0 +1,94 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows;
+using TextLocator.Core;
+
+namespace TextLocator.ViewModel.Main
+{
+ ///
+ /// MainWindow模型
+ ///
+ public class MainViewModel: NotificationObject
+ {
+ private MainModel model;
+
+ public MainViewModel()
+ {
+ model = new MainModel()
+ {
+ PageIndex = 1,
+ PageSize = AppConst.MRESULT_LIST_PAGE_SIZE,
+ TotalCount = 0,
+
+ PreviewPage = "0/0",
+ PreviewSwitchVisibility = Visibility.Hidden
+ };
+ }
+ ///
+ /// 当前页
+ ///
+ public int PageIndex
+ {
+ get { return model.PageIndex; }
+ set
+ {
+ model.PageIndex = value;
+ RaisePropertyChanged("PageIndex");
+ }
+ }
+ ///
+ /// 分页条数
+ ///
+ public int PageSize
+ {
+ // 获取值时将私有字段传出;
+ get { return model.PageSize; }
+ // 赋值时将值传给私有字段
+ set
+ {
+ model.PageSize= value;
+ RaisePropertyChanged("PageSize");
+ }
+ }
+ ///
+ /// 结果总条数
+ ///
+ public int TotalCount
+ {
+ get { return model.TotalCount; }
+ set
+ {
+ model.TotalCount = value;
+ RaisePropertyChanged("TotalCount");
+ }
+ }
+
+ ///
+ /// 预览分页
+ ///
+ public string PreviewPage {
+ get { return model.PreviewPage; }
+ set
+ {
+ model.PreviewPage = value;
+ RaisePropertyChanged("PreviewPage");
+ }
+ }
+
+ ///
+ /// 切换预览显示状态
+ ///
+ public Visibility PreviewSwitchVisibility
+ {
+ get { return model.PreviewSwitchVisibility; }
+ set
+ {
+ model.PreviewSwitchVisibility = value;
+ RaisePropertyChanged("PreviewSwitchVisibility");
+ }
+ }
+ }
+}
diff --git a/TextLocator/ViewModel/NotificationObject.cs b/TextLocator/ViewModel/NotificationObject.cs
new file mode 100644
index 0000000000000000000000000000000000000000..e406a4fd93d345de094e1e2173b2126e7b184283
--- /dev/null
+++ b/TextLocator/ViewModel/NotificationObject.cs
@@ -0,0 +1,17 @@
+using System.ComponentModel;
+
+namespace TextLocator.ViewModel
+{
+ public abstract class NotificationObject : INotifyPropertyChanged
+ {
+ public event PropertyChangedEventHandler PropertyChanged;
+ ///
+ /// 发起通知
+ ///
+ /// 属性名
+ public void RaisePropertyChanged(string propertyName)
+ {
+ PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
+ }
+ }
+}