Fix bugs in search rule matching

This commit is contained in:
Justin Aquadro 2014-02-19 20:29:22 -05:00
parent d4ad1bd99a
commit c5debf12d4

View file

@ -169,8 +169,9 @@ namespace NBTExplorer.Model.Search
{
TagDataNode childNode = GetChild(container, Name);
T data = LookupTag<T>(container, Name);
if (data == null)
return false;
if (data != null) {
switch (Operator) {
case NumericOperator.Equals:
if (data.ToTagLong() != Value)
@ -188,7 +189,10 @@ namespace NBTExplorer.Model.Search
if (data.ToTagLong() >= Value)
return false;
break;
}
case NumericOperator.Any:
break;
default:
return false;
}
if (!matchedNodes.Contains(childNode))
@ -226,8 +230,9 @@ namespace NBTExplorer.Model.Search
{
TagDataNode childNode = GetChild(container, Name);
T data = LookupTag<T>(container, Name);
if (data == null)
return false;
if (data != null) {
switch (Operator) {
case NumericOperator.Equals:
if (data.ToTagDouble() != Value)
@ -245,7 +250,10 @@ namespace NBTExplorer.Model.Search
if (data.ToTagDouble() >= Value)
return false;
break;
}
case NumericOperator.Any:
break;
default:
return false;
}
if (!matchedNodes.Contains(childNode))
@ -276,8 +284,9 @@ namespace NBTExplorer.Model.Search
{
TagDataNode childNode = GetChild(container, Name);
TagNodeString data = LookupTag<TagNodeString>(container, Name);
if (data == null)
return false;
if (data != null) {
switch (Operator) {
case StringOperator.Equals:
if (data.ToTagString().Data != Value)
@ -303,7 +312,10 @@ namespace NBTExplorer.Model.Search
if (!data.ToTagString().Data.EndsWith(Value))
return false;
break;
}
case StringOperator.Any:
break;
default:
return false;
}
if (!matchedNodes.Contains(childNode))