forked from mirrors/NBTExplorer
Fix bugs in search rule matching
This commit is contained in:
parent
d4ad1bd99a
commit
c5debf12d4
1 changed files with 77 additions and 65 deletions
|
@ -169,8 +169,9 @@ namespace NBTExplorer.Model.Search
|
||||||
{
|
{
|
||||||
TagDataNode childNode = GetChild(container, Name);
|
TagDataNode childNode = GetChild(container, Name);
|
||||||
T data = LookupTag<T>(container, Name);
|
T data = LookupTag<T>(container, Name);
|
||||||
|
if (data == null)
|
||||||
|
return false;
|
||||||
|
|
||||||
if (data != null) {
|
|
||||||
switch (Operator) {
|
switch (Operator) {
|
||||||
case NumericOperator.Equals:
|
case NumericOperator.Equals:
|
||||||
if (data.ToTagLong() != Value)
|
if (data.ToTagLong() != Value)
|
||||||
|
@ -188,7 +189,10 @@ namespace NBTExplorer.Model.Search
|
||||||
if (data.ToTagLong() >= Value)
|
if (data.ToTagLong() >= Value)
|
||||||
return false;
|
return false;
|
||||||
break;
|
break;
|
||||||
}
|
case NumericOperator.Any:
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!matchedNodes.Contains(childNode))
|
if (!matchedNodes.Contains(childNode))
|
||||||
|
@ -226,8 +230,9 @@ namespace NBTExplorer.Model.Search
|
||||||
{
|
{
|
||||||
TagDataNode childNode = GetChild(container, Name);
|
TagDataNode childNode = GetChild(container, Name);
|
||||||
T data = LookupTag<T>(container, Name);
|
T data = LookupTag<T>(container, Name);
|
||||||
|
if (data == null)
|
||||||
|
return false;
|
||||||
|
|
||||||
if (data != null) {
|
|
||||||
switch (Operator) {
|
switch (Operator) {
|
||||||
case NumericOperator.Equals:
|
case NumericOperator.Equals:
|
||||||
if (data.ToTagDouble() != Value)
|
if (data.ToTagDouble() != Value)
|
||||||
|
@ -245,7 +250,10 @@ namespace NBTExplorer.Model.Search
|
||||||
if (data.ToTagDouble() >= Value)
|
if (data.ToTagDouble() >= Value)
|
||||||
return false;
|
return false;
|
||||||
break;
|
break;
|
||||||
}
|
case NumericOperator.Any:
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!matchedNodes.Contains(childNode))
|
if (!matchedNodes.Contains(childNode))
|
||||||
|
@ -276,8 +284,9 @@ namespace NBTExplorer.Model.Search
|
||||||
{
|
{
|
||||||
TagDataNode childNode = GetChild(container, Name);
|
TagDataNode childNode = GetChild(container, Name);
|
||||||
TagNodeString data = LookupTag<TagNodeString>(container, Name);
|
TagNodeString data = LookupTag<TagNodeString>(container, Name);
|
||||||
|
if (data == null)
|
||||||
|
return false;
|
||||||
|
|
||||||
if (data != null) {
|
|
||||||
switch (Operator) {
|
switch (Operator) {
|
||||||
case StringOperator.Equals:
|
case StringOperator.Equals:
|
||||||
if (data.ToTagString().Data != Value)
|
if (data.ToTagString().Data != Value)
|
||||||
|
@ -303,7 +312,10 @@ namespace NBTExplorer.Model.Search
|
||||||
if (!data.ToTagString().Data.EndsWith(Value))
|
if (!data.ToTagString().Data.EndsWith(Value))
|
||||||
return false;
|
return false;
|
||||||
break;
|
break;
|
||||||
}
|
case StringOperator.Any:
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!matchedNodes.Contains(childNode))
|
if (!matchedNodes.Contains(childNode))
|
||||||
|
|
Loading…
Reference in a new issue