12345678910111213141516171819202122232425262728293031323334353637383940 |
- /*
- * 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);
- }
- }
- }
|