EVERYTHING
This commit is contained in:
@@ -0,0 +1,23 @@
|
||||
using System;
|
||||
|
||||
internal static class BSValueUtility
|
||||
{
|
||||
public static bool Equals(BSValue a, BSValue b)
|
||||
{
|
||||
a = a.Normalize();
|
||||
b = b.Normalize();
|
||||
if (a.Kind != b.Kind)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return a.Kind switch
|
||||
{
|
||||
BSValueKind.Number => Math.Abs(a.Number - b.Number) <= 0.0001,
|
||||
BSValueKind.Text => string.Equals(a.Text ?? string.Empty, b.Text ?? string.Empty, StringComparison.Ordinal),
|
||||
BSValueKind.Bool => a.Bool == b.Bool,
|
||||
BSValueKind.Player => a.PlayerId == b.PlayerId,
|
||||
BSValueKind.Group => a.GroupId == b.GroupId,
|
||||
_ => true,
|
||||
};
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user