- AssetBrowser Optimizations.
- Filter options added to `AssetBrowser`. - New game entry. - Togglable Model Preview. - bug fixes.
This commit is contained in:
@@ -1,5 +1,7 @@
|
||||
using MessagePack;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text.RegularExpressions;
|
||||
|
||||
namespace AssetStudio
|
||||
@@ -26,10 +28,22 @@ namespace AssetStudio
|
||||
[Key(4)]
|
||||
public ClassIDType Type { get; set; }
|
||||
|
||||
public bool Matches(Regex regex) => regex.IsMatch(Name)
|
||||
|| regex.IsMatch(Container)
|
||||
|| regex.IsMatch(Source)
|
||||
|| regex.IsMatch(PathID.ToString())
|
||||
|| regex.IsMatch(Type.ToString());
|
||||
public bool Matches(Dictionary<string, Regex> filters)
|
||||
{
|
||||
var matches = new List<bool>();
|
||||
foreach(var filter in filters)
|
||||
{
|
||||
matches.Add(filter.Key switch
|
||||
{
|
||||
string value when value.Equals(nameof(Name), StringComparison.OrdinalIgnoreCase) => filter.Value.IsMatch(Name),
|
||||
string value when value.Equals(nameof(Container), StringComparison.OrdinalIgnoreCase) => filter.Value.IsMatch(Container),
|
||||
string value when value.Equals(nameof(Source), StringComparison.OrdinalIgnoreCase) => filter.Value.IsMatch(Source),
|
||||
string value when value.Equals(nameof(PathID), StringComparison.OrdinalIgnoreCase) => filter.Value.IsMatch(PathID.ToString()),
|
||||
string value when value.Equals(nameof (Type), StringComparison.OrdinalIgnoreCase) => filter.Value.IsMatch(Type.ToString()),
|
||||
_ => throw new NotImplementedException()
|
||||
});
|
||||
}
|
||||
return matches.Count(x => x == true) == filters.Count;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user