diff --git a/Core/Core.csproj b/Core/Core.csproj
index 5ed8a9c..31ac218 100644
--- a/Core/Core.csproj
+++ b/Core/Core.csproj
@@ -144,6 +144,7 @@
+
diff --git a/Core/Librarys/RegexHelper.cs b/Core/Librarys/RegexHelper.cs
new file mode 100644
index 0000000..2a5ab09
--- /dev/null
+++ b/Core/Librarys/RegexHelper.cs
@@ -0,0 +1,31 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Text.RegularExpressions;
+using System.Threading.Tasks;
+
+namespace Core.Librarys
+{
+ public static class RegexHelper
+ {
+ ///
+ /// 是否正则匹配成功
+ ///
+ ///
+ ///
+ ///
+ public static bool IsMatch(string input, string pattern)
+ {
+ try
+ {
+ return Regex.IsMatch(input, pattern);
+ }
+ catch (Exception ex)
+ {
+ Logger.Error("正则表达式错误。" + ex.ToString());
+ return false;
+ }
+ }
+ }
+}
diff --git a/Core/Models/Config/BehaviorModel.cs b/Core/Models/Config/BehaviorModel.cs
index 266ad9c..7108f14 100644
--- a/Core/Models/Config/BehaviorModel.cs
+++ b/Core/Models/Config/BehaviorModel.cs
@@ -11,7 +11,7 @@ namespace Core.Models.Config
///
public class BehaviorModel
{
- [Config(IsCanImportExport = true, Name = "忽略应用", Description = "忽略的应用将不进行时长统计", Group = "忽略应用", Placeholder = "应用进程名称,不需要输入.exe。支持正则表达式")]
+ [Config(IsCanImportExport = true, Name = "忽略应用", Description = "可以通过进程名称或者正则表达式进行匹配。当使用正则表达式时可以匹配程序路径", Group = "忽略应用", Placeholder = "进程名称,不需要输入.exe。支持正则表达式")]
///
/// 忽略的进程列表
///
diff --git a/Core/Servicers/Instances/Main.cs b/Core/Servicers/Instances/Main.cs
index 2c72f91..333fbe4 100644
--- a/Core/Servicers/Instances/Main.cs
+++ b/Core/Servicers/Instances/Main.cs
@@ -254,10 +254,9 @@ private bool IsCheckApp(string processName, string description, string file)
// 正则表达式
foreach (string reg in ConfigIgnoreProcessRegxList)
{
- if (Regex.IsMatch(processName, reg))
+ if (RegexHelper.IsMatch(processName, reg) || RegexHelper.IsMatch(file, reg))
{
IgnoreProcessCacheList.Add(processName);
-
return false;
}
}
diff --git a/UI/Controls/SettingPanel/SettingPanel.cs b/UI/Controls/SettingPanel/SettingPanel.cs
index d3c2e71..e06a24a 100644
--- a/UI/Controls/SettingPanel/SettingPanel.cs
+++ b/UI/Controls/SettingPanel/SettingPanel.cs
@@ -484,6 +484,14 @@ private UIElement RenderListStringConfigControl(ConfigAttribute configAttribute,
{
listControl.Items.Remove(listControl.SelectedItem);
};
+ var contextMenuItemCopy = new MenuItem();
+ contextMenuItemCopy.Header = "复制内容";
+ contextMenuItemCopy.Click += (e, c) =>
+ {
+ Clipboard.SetText(listControl.SelectedItem);
+ };
+ contextMenu.Items.Add(contextMenuItemCopy);
+ contextMenu.Items.Add(new Separator());
contextMenu.Items.Add(contextMenuItemDel);
listControl.ContextMenu = contextMenu;
diff --git a/UI/Models/DetailPageModel.cs b/UI/Models/DetailPageModel.cs
index eb20092..57353aa 100644
--- a/UI/Models/DetailPageModel.cs
+++ b/UI/Models/DetailPageModel.cs
@@ -161,5 +161,10 @@ public int TabbarSelectedIndex
/// 关联的应用
///
public List LinkApps { get { return LinkApps_; } set { LinkApps_ = value; OnPropertyChanged(); } }
+ private bool IsRegexIgnore_;
+ ///
+ /// 是否已被正则忽略
+ ///
+ public bool IsRegexIgnore { get { return IsRegexIgnore_; } set { IsRegexIgnore_ = value; OnPropertyChanged(); } }
}
}
diff --git a/UI/ViewModels/DetailPageVM.cs b/UI/ViewModels/DetailPageVM.cs
index 4d9e345..ec8ebce 100644
--- a/UI/ViewModels/DetailPageVM.cs
+++ b/UI/ViewModels/DetailPageVM.cs
@@ -7,6 +7,7 @@
using System.IO;
using System.Linq;
using System.Text;
+using System.Text.RegularExpressions;
using System.Threading.Tasks;
using System.Windows;
using UI.Controls;
@@ -98,8 +99,20 @@ private async void Init()
LoadDayData();
inputServicer.OnKeyUpInput += InputServicer_OnKeyUpInput;
+
+ // 判断正则忽略
+ var regexList = config.Behavior.IgnoreProcessList.Where(m => Regex.IsMatch(m, @"[\.|\*|\?|\{|\\|\[|\^|\|]"));
+ foreach (string reg in regexList)
+ {
+ if (RegexHelper.IsMatch(App.Name, reg) || RegexHelper.IsMatch(App.File, reg))
+ {
+ IsRegexIgnore = true;
+ break;
+ }
+ }
}
+
private async void InputServicer_OnKeyUpInput(object sender, System.Windows.Forms.Keys key)
{
if (key == System.Windows.Forms.Keys.F5)
diff --git a/UI/Views/DetailPage.xaml b/UI/Views/DetailPage.xaml
index 058ae06..4a2173d 100644
--- a/UI/Views/DetailPage.xaml
+++ b/UI/Views/DetailPage.xaml
@@ -56,13 +56,22 @@
-->
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -85,12 +94,13 @@
-
+
+
忽略此应用
取消忽略
-
+