mirror of
https://github.com/openbullet/openbullet.git
synced 2023-10-21 07:33:42 -05:00
Implemented the DoesNotExist condition.
This commit is contained in:
@@ -76,7 +76,7 @@ namespace RuriLib
|
||||
{
|
||||
k.LeftTerm = first;
|
||||
k.Condition = (Condition)LineParser.ParseEnum(ref input, "Condition", typeof(Condition));
|
||||
if (k.Condition != Condition.Exists)
|
||||
if (k.Condition != Condition.Exists && k.Condition != Condition.DoesNotExist)
|
||||
k.RightTerm = LineParser.ParseLiteral(ref input, "Right Term");
|
||||
}
|
||||
|
||||
@@ -128,7 +128,7 @@ namespace RuriLib
|
||||
.Literal(k.LeftTerm)
|
||||
.Token(k.Condition);
|
||||
|
||||
if (k.Condition != Condition.Exists)
|
||||
if (k.Condition != Condition.Exists && k.Condition != Condition.DoesNotExist)
|
||||
writer.Literal(k.RightTerm);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -28,7 +28,10 @@ namespace RuriLib
|
||||
DoesNotContain,
|
||||
|
||||
/// <summary>Whether any variable can be replaced inside the string.</summary>
|
||||
Exists
|
||||
Exists,
|
||||
|
||||
/// <summary>Whether no variable can be replaced inside the string.</summary>
|
||||
DoesNotExist
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -74,6 +77,9 @@ namespace RuriLib
|
||||
case Condition.Exists:
|
||||
return L.Any(l => l != left); // Returns true if any replacement took place
|
||||
|
||||
case Condition.DoesNotExist:
|
||||
return L.All(l => l == left); // Returns true if no replacement took place
|
||||
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -426,7 +426,7 @@ namespace RuriLib.LS
|
||||
var first = LineParser.ParseLiteral(ref cfLine, "STRING");
|
||||
var condition = (Condition)LineParser.ParseEnum(ref cfLine, "CONDITION", typeof(Condition));
|
||||
var second = "";
|
||||
if (condition != Condition.Exists)
|
||||
if (condition != Condition.Exists && condition != Condition.DoesNotExist)
|
||||
second = LineParser.ParseLiteral(ref cfLine, "STRING");
|
||||
return (ConditionChecker.Verify(first, condition, second, data));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user