mirror of
https://github.com/ShareX/ShareX.git
synced 2024-06-28 19:20:27 +12:00
In image history window support searching tags
This commit is contained in:
parent
e1ee32f7cd
commit
8874c18fe7
|
@ -40,6 +40,7 @@ public partial class ImageHistoryForm : Form
|
|||
public string HistoryPath { get; private set; }
|
||||
public ImageHistorySettings Settings { get; private set; }
|
||||
public string SearchText { get; set; }
|
||||
public bool SearchInTags { get; set; } = true;
|
||||
|
||||
private HistoryManager history;
|
||||
private HistoryItemManager him;
|
||||
|
@ -124,7 +125,7 @@ private IEnumerable<HistoryItem> GetHistoryItems()
|
|||
if (!string.IsNullOrEmpty(SearchText))
|
||||
{
|
||||
string pattern = Regex.Escape(SearchText).Replace("\\?", ".").Replace("\\*", ".*");
|
||||
regex = new Regex(pattern, RegexOptions.IgnoreCase | RegexOptions.CultureInvariant);
|
||||
regex = new Regex(pattern, RegexOptions.Compiled | RegexOptions.IgnoreCase | RegexOptions.CultureInvariant);
|
||||
}
|
||||
|
||||
for (int i = historyItems.Count - 1; i >= 0; i--)
|
||||
|
@ -132,7 +133,7 @@ private IEnumerable<HistoryItem> GetHistoryItems()
|
|||
HistoryItem hi = historyItems[i];
|
||||
|
||||
if (!string.IsNullOrEmpty(hi.FilePath) && Helpers.IsImageFile(hi.FilePath) &&
|
||||
(regex == null || regex.IsMatch(hi.FileName)) &&
|
||||
(regex == null || regex.IsMatch(hi.FileName) || (SearchInTags && hi.Tags != null && hi.Tags.Any(tag => regex.IsMatch(tag.Value)))) &&
|
||||
(!Settings.FilterMissingFiles || File.Exists(hi.FilePath)))
|
||||
{
|
||||
filteredHistoryItems.Add(hi);
|
||||
|
|
Loading…
Reference in a new issue