Initial Commit
This commit is contained in:
@@ -0,0 +1,40 @@
|
||||
/*
|
||||
* 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);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user