Files
2025-07-04 20:33:06 +03:00

41 lines
979 B
C#

/*
* Copyright (c) Meta Platforms, Inc. and affiliates.
* All rights reserved.
*
* This source code is licensed under the license found in the
* LICENSE file in the root directory of this source tree.
*/
using Meta.WitAi.Json;
namespace Meta.WitAi.Data
{
public class WitIntValue : WitValue
{
public override object GetValue(WitResponseNode response)
{
return GetIntValue(response);
}
public override bool Equals(WitResponseNode response, object value)
{
int iValue = 0;
if (value is int i)
{
iValue = i;
}
else if (null != value && !int.TryParse("" + value, out iValue))
{
return false;
}
return GetIntValue(response) == iValue;
}
public int GetIntValue(WitResponseNode response)
{
return Reference.GetIntValue(response);
}
}
}