Added search by hash to Searchbar

This commit is contained in:
erri120 2020-02-15 16:53:51 +01:00
parent b250a89684
commit bef69012b2
No known key found for this signature in database
GPG Key ID: A8C0A18D8D4D3135

View File

@ -38,9 +38,15 @@ namespace Wabbajack
.DistinctUntilChanged()
.Select(term =>
{
return string.IsNullOrWhiteSpace(term)
? Archives
: Archives.Where(x => x.Name.StartsWith(term));
if (string.IsNullOrWhiteSpace(term))
return Archives;
return Archives.Where(x =>
{
if (term.StartsWith("hash:"))
return x.Hash.StartsWith(term.Replace("hash:", ""));
return x.Name.StartsWith(term);
});
})
.ToGuiProperty(this, nameof(SearchResults), Archives);
}