mirror of
https://github.com/ShareX/ShareX.git
synced 2024-10-01 17:56:51 +13:00
In image history window support searching tags
This commit is contained in:
parent
e1ee32f7cd
commit
8874c18fe7
1 changed files with 3 additions and 2 deletions
|
@ -40,6 +40,7 @@ public partial class ImageHistoryForm : Form
|
||||||
public string HistoryPath { get; private set; }
|
public string HistoryPath { get; private set; }
|
||||||
public ImageHistorySettings Settings { get; private set; }
|
public ImageHistorySettings Settings { get; private set; }
|
||||||
public string SearchText { get; set; }
|
public string SearchText { get; set; }
|
||||||
|
public bool SearchInTags { get; set; } = true;
|
||||||
|
|
||||||
private HistoryManager history;
|
private HistoryManager history;
|
||||||
private HistoryItemManager him;
|
private HistoryItemManager him;
|
||||||
|
@ -124,7 +125,7 @@ private IEnumerable<HistoryItem> GetHistoryItems()
|
||||||
if (!string.IsNullOrEmpty(SearchText))
|
if (!string.IsNullOrEmpty(SearchText))
|
||||||
{
|
{
|
||||||
string pattern = Regex.Escape(SearchText).Replace("\\?", ".").Replace("\\*", ".*");
|
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--)
|
for (int i = historyItems.Count - 1; i >= 0; i--)
|
||||||
|
@ -132,7 +133,7 @@ private IEnumerable<HistoryItem> GetHistoryItems()
|
||||||
HistoryItem hi = historyItems[i];
|
HistoryItem hi = historyItems[i];
|
||||||
|
|
||||||
if (!string.IsNullOrEmpty(hi.FilePath) && Helpers.IsImageFile(hi.FilePath) &&
|
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)))
|
(!Settings.FilterMissingFiles || File.Exists(hi.FilePath)))
|
||||||
{
|
{
|
||||||
filteredHistoryItems.Add(hi);
|
filteredHistoryItems.Add(hi);
|
||||||
|
|
Loading…
Reference in a new issue