提交记录修改Core/Core.csproj+1 −0看文件
新增Core/Librarys/RegexHelper.cs+31 −0看文件
修改Core/Models/Config/BehaviorModel.cs+1 −1看文件
修改Core/Servicers/Instances/Main.cs+1 −2看文件
修改UI/Controls/SettingPanel/SettingPanel.cs+8 −0看文件
修改UI/Models/DetailPageModel.cs+5 −0看文件
修改UI/ViewModels/DetailPageVM.cs+13 −0看文件
修改UI/Views/DetailPage.xaml+19 −9看文件
| @@ -144,6 +144,7 @@ | ||
| 144 | 144 | <Compile Include="Event\EventHandler.cs" /> |
| 145 | 145 | <Compile Include="Event\ObserverEventHandler.cs" /> |
| 146 | 146 | <Compile Include="Librarys\ProcessHelper.cs" /> |
| 147 | 新增: <Compile Include="Librarys\RegexHelper.cs" /> | |
| 147 | 148 | <Compile Include="Librarys\Shortcut.cs" /> |
| 148 | 149 | <Compile Include="Librarys\Iconer.cs" /> |
| 149 | 150 | <Compile Include="Librarys\SQLite\SQLiteBuilder.cs" /> |
| @@ -0,0 +1,31 @@ | ||
| 1 | 新增:using System; | |
| 2 | 新增:using System.Collections.Generic; | |
| 3 | 新增:using System.Linq; | |
| 4 | 新增:using System.Text; | |
| 5 | 新增:using System.Text.RegularExpressions; | |
| 6 | 新增:using System.Threading.Tasks; | |
| 7 | 新增: | |
| 8 | 新增:namespace Core.Librarys | |
| 9 | 新增:{ | |
| 10 | 新增: public static class RegexHelper | |
| 11 | 新增: { | |
| 12 | 新增: /// <summary> | |
| 13 | 新增: /// 是否正则匹配成功 | |
| 14 | 新增: /// </summary> | |
| 15 | 新增: /// <param name="input"></param> | |
| 16 | 新增: /// <param name="pattern"></param> | |
| 17 | 新增: /// <returns></returns> | |
| 18 | 新增: public static bool IsMatch(string input, string pattern) | |
| 19 | 新增: { | |
| 20 | 新增: try | |
| 21 | 新增: { | |
| 22 | 新增: return Regex.IsMatch(input, pattern); | |
| 23 | 新增: } | |
| 24 | 新增: catch (Exception ex) | |
| 25 | 新增: { | |
| 26 | 新增: Logger.Error("正则表达式错误。" + ex.ToString()); | |
| 27 | 新增: return false; | |
| 28 | 新增: } | |
| 29 | 新增: } | |
| 30 | 新增: } | |
| 31 | 新增:} | |
| @@ -11,7 +11,7 @@ namespace Core.Models.Config | ||
| 11 | 11 | /// </summary> |
| 12 | 12 | public class BehaviorModel |
| 13 | 13 | { |
| 14 | 删除: [Config(IsCanImportExport = true, Name = "忽略应用", Description = "忽略的应用将不进行时长统计", Group = "忽略应用", Placeholder = "应用进程名称,不需要输入.exe。支持正则表达式")] | |
| 14 | 新增: [Config(IsCanImportExport = true, Name = "忽略应用", Description = "可以通过进程名称或者正则表达式进行匹配。当使用正则表达式时可以匹配程序路径", Group = "忽略应用", Placeholder = "进程名称,不需要输入.exe。支持正则表达式")] | |
| 15 | 15 | /// <summary> |
| 16 | 16 | /// 忽略的进程列表 |
| 17 | 17 | /// </summary> |
| @@ -254,10 +254,9 @@ namespace Core.Servicers.Instances | ||
| 254 | 254 | // 正则表达式 |
| 255 | 255 | foreach (string reg in ConfigIgnoreProcessRegxList) |
| 256 | 256 | { |
| 257 | 删除: if (Regex.IsMatch(processName, reg)) | |
| 257 | 新增: if (RegexHelper.IsMatch(processName, reg) || RegexHelper.IsMatch(file, reg)) | |
| 258 | 258 | { |
| 259 | 259 | IgnoreProcessCacheList.Add(processName); |
| 260 | 删除: | |
| 261 | 260 | return false; |
| 262 | 261 | } |
| 263 | 262 | } |
| @@ -484,6 +484,14 @@ namespace UI.Controls.SettingPanel | ||
| 484 | 484 | { |
| 485 | 485 | listControl.Items.Remove(listControl.SelectedItem); |
| 486 | 486 | }; |
| 487 | 新增: var contextMenuItemCopy = new MenuItem(); | |
| 488 | 新增: contextMenuItemCopy.Header = "复制内容"; | |
| 489 | 新增: contextMenuItemCopy.Click += (e, c) => | |
| 490 | 新增: { | |
| 491 | 新增: Clipboard.SetText(listControl.SelectedItem); | |
| 492 | 新增: }; | |
| 493 | 新增: contextMenu.Items.Add(contextMenuItemCopy); | |
| 494 | 新增: contextMenu.Items.Add(new Separator()); | |
| 487 | 495 | contextMenu.Items.Add(contextMenuItemDel); |
| 488 | 496 | listControl.ContextMenu = contextMenu; |
| 489 | 497 | |
| @@ -161,5 +161,10 @@ namespace UI.Models | ||
| 161 | 161 | /// 关联的应用 |
| 162 | 162 | /// </summary> |
| 163 | 163 | public List<AppModel> LinkApps { get { return LinkApps_; } set { LinkApps_ = value; OnPropertyChanged(); } } |
| 164 | 新增: private bool IsRegexIgnore_; | |
| 165 | 新增: /// <summary> | |
| 166 | 新增: /// 是否已被正则忽略 | |
| 167 | 新增: /// </summary> | |
| 168 | 新增: public bool IsRegexIgnore { get { return IsRegexIgnore_; } set { IsRegexIgnore_ = value; OnPropertyChanged(); } } | |
| 164 | 169 | } |
| 165 | 170 | } |
| @@ -7,6 +7,7 @@ using System.Collections.Generic; | ||
| 7 | 7 | using System.IO; |
| 8 | 8 | using System.Linq; |
| 9 | 9 | using System.Text; |
| 10 | 新增:using System.Text.RegularExpressions; | |
| 10 | 11 | using System.Threading.Tasks; |
| 11 | 12 | using System.Windows; |
| 12 | 13 | using UI.Controls; |
| @@ -98,8 +99,20 @@ namespace UI.ViewModels | ||
| 98 | 99 | LoadDayData(); |
| 99 | 100 | |
| 100 | 101 | inputServicer.OnKeyUpInput += InputServicer_OnKeyUpInput; |
| 102 | 新增: | |
| 103 | 新增: // 判断正则忽略 | |
| 104 | 新增: var regexList = config.Behavior.IgnoreProcessList.Where(m => Regex.IsMatch(m, @"[\.|\*|\?|\{|\\|\[|\^|\|]")); | |
| 105 | 新增: foreach (string reg in regexList) | |
| 106 | 新增: { | |
| 107 | 新增: if (RegexHelper.IsMatch(App.Name, reg) || RegexHelper.IsMatch(App.File, reg)) | |
| 108 | 新增: { | |
| 109 | 新增: IsRegexIgnore = true; | |
| 110 | 新增: break; | |
| 111 | 新增: } | |
| 112 | 新增: } | |
| 101 | 113 | } |
| 102 | 114 | |
| 115 | 新增: | |
| 103 | 116 | private async void InputServicer_OnKeyUpInput(object sender, System.Windows.Forms.Keys key) |
| 104 | 117 | { |
| 105 | 118 | if (key == System.Windows.Forms.Keys.F5) |
| @@ -56,13 +56,22 @@ | ||
| 56 | 56 | <TextBlock ToolTip="进程名" Text="{Binding ProcessName}" FontSize="12" Foreground="Gray" VerticalAlignment="Center" Margin="10,0,0,0"/> |
| 57 | 57 | |
| 58 | 58 | </StackPanel>--> |
| 59 | 删除: <Border Background="#f51837" Padding="10,5" CornerRadius="4" Margin="0,0,0,5" VerticalAlignment="Center" HorizontalAlignment="Left" Visibility="{Binding CancelBlockBtnVisibility}" ToolTip="该应用将不再统计使用时长"> | |
| 60 | 删除: <StackPanel Orientation="Horizontal" VerticalAlignment="Center"> | |
| 61 | 删除: <base:Icon IconType="StatusCircleBlock" FontSize="12" VerticalAlignment="Center" Foreground="White"/> | |
| 62 | 删除: <TextBlock Text="已被忽略" Foreground="White" VerticalAlignment="Center" Margin="5,0,0,0"/> | |
| 63 | 删除: </StackPanel> | |
| 64 | 删除: </Border> | |
| 65 | 删除: | |
| 59 | 新增: <base:View Condition="=false" Value="{Binding IsRegexIgnore}"> | |
| 60 | 新增: <Border Background="#f51837" Padding="10,5" CornerRadius="4" Margin="0,0,0,5" VerticalAlignment="Center" HorizontalAlignment="Left" Visibility="{Binding CancelBlockBtnVisibility}" ToolTip="该应用将不再统计使用时长"> | |
| 61 | 新增: <StackPanel Orientation="Horizontal" VerticalAlignment="Center"> | |
| 62 | 新增: <base:Icon IconType="StatusCircleBlock" FontSize="12" VerticalAlignment="Center" Foreground="White"/> | |
| 63 | 新增: <TextBlock Text="已被忽略" Foreground="White" VerticalAlignment="Center" Margin="5,0,0,0"/> | |
| 64 | 新增: </StackPanel> | |
| 65 | 新增: </Border> | |
| 66 | 新增: </base:View> | |
| 67 | 新增: <base:View Value="{Binding IsRegexIgnore}"> | |
| 68 | 新增: <Border Background="#f51837" Padding="10,5" CornerRadius="4" Margin="0,0,0,5" VerticalAlignment="Center" HorizontalAlignment="Left" ToolTip="该应用将不再统计使用时长"> | |
| 69 | 新增: <StackPanel Orientation="Horizontal" VerticalAlignment="Center"> | |
| 70 | 新增: <base:Icon IconType="StatusCircleBlock" FontSize="12" VerticalAlignment="Center" Foreground="White"/> | |
| 71 | 新增: <TextBlock Text="已被正则忽略匹配" Foreground="White" VerticalAlignment="Center" Margin="5,0,0,0"/> | |
| 72 | 新增: </StackPanel> | |
| 73 | 新增: </Border> | |
| 74 | 新增: </base:View> | |
| 66 | 75 | <TextBlock ToolTip="应用描述" Grid.Column="1" Text="{Binding App.Description}" FontSize="18" VerticalAlignment="Center" TextWrapping="WrapWithOverflow"/> |
| 67 | 76 | |
| 68 | 77 | <TextBlock ToolTip="应用进程名称" Text="{Binding App.Name}" FontSize="12" Foreground="Gray" VerticalAlignment="Center" HorizontalAlignment="Left" Margin="0,5,0,0"/> |
| @@ -85,12 +94,13 @@ | ||
| 85 | 94 | |
| 86 | 95 | </StackPanel> |
| 87 | 96 | <Grid Grid.Column="2"> |
| 88 | 删除: <StackPanel Grid.Column="2" HorizontalAlignment="Right" Margin="0,0,20,0"> | |
| 97 | 新增: <base:View Grid.Column="2" Condition="=false" Value="{Binding IsRegexIgnore}"> | |
| 98 | 新增: <StackPanel HorizontalAlignment="Right" Margin="0,0,20,0"> | |
| 89 | 99 | <btn:Button Command="{Binding BlockActionCommand}" CommandParameter="block" Width="120" Visibility="{Binding BlockBtnVisibility}" Icon="StatusCircleBlock">忽略此应用</btn:Button> |
| 90 | 100 | <btn:Button Command="{Binding BlockActionCommand}" CommandParameter="unblock" Width="120" Visibility="{Binding CancelBlockBtnVisibility}" Icon="Remove">取消忽略</btn:Button> |
| 91 | 101 | |
| 92 | 102 | </StackPanel> |
| 93 | 删除: | |
| 103 | 新增: </base:View> | |
| 94 | 104 | <ItemsControl Margin="0,20,10,0" VerticalAlignment="Bottom" ItemsSource="{Binding LinkApps}" HorizontalAlignment="Right"> |
| 95 | 105 | <ItemsControl.ItemsPanel> |
| 96 | 106 | <ItemsPanelTemplate> |

