mirror of
https://github.com/ShareX/ShareX.git
synced 2024-09-30 01:07:21 +13:00
In history window support searching tags
This commit is contained in:
parent
5500e4d553
commit
e1ee32f7cd
1 changed files with 4 additions and 2 deletions
|
@ -39,6 +39,7 @@ public partial class HistoryForm : Form
|
|||
{
|
||||
public string HistoryPath { get; private set; }
|
||||
public HistorySettings Settings { get; private set; }
|
||||
public bool SearchInTags { get; set; } = true;
|
||||
|
||||
private HistoryManager history;
|
||||
private HistoryItemManager him;
|
||||
|
@ -213,8 +214,9 @@ private HistoryItem[] ApplyFilters(HistoryItem[] historyItems)
|
|||
if (!string.IsNullOrEmpty(filenameFilter))
|
||||
{
|
||||
string pattern = Regex.Escape(filenameFilter).Replace("\\?", ".").Replace("\\*", ".*");
|
||||
Regex regex = new Regex(pattern, RegexOptions.IgnoreCase | RegexOptions.CultureInvariant);
|
||||
result = result.Where(x => x.FileName != null && regex.IsMatch(x.FileName));
|
||||
Regex regex = new Regex(pattern, RegexOptions.Compiled | RegexOptions.IgnoreCase | RegexOptions.CultureInvariant);
|
||||
result = result.Where(x => (x.FileName != null && regex.IsMatch(x.FileName)) ||
|
||||
(SearchInTags && x.Tags != null && x.Tags.Any(tag => regex.IsMatch(tag.Value))));
|
||||
}
|
||||
|
||||
string urlFilter = txtURLFilter.Text;
|
||||
|
|
Loading…
Reference in a new issue