WitStringValue.cs 877 B

1234567891011121314151617181920212223242526272829303132333435
  1. /*
  2. * Copyright (c) Meta Platforms, Inc. and affiliates.
  3. * All rights reserved.
  4. *
  5. * This source code is licensed under the license found in the
  6. * LICENSE file in the root directory of this source tree.
  7. */
  8. using Meta.WitAi.Json;
  9. namespace Meta.WitAi.Data
  10. {
  11. public class WitStringValue : WitValue
  12. {
  13. public override object GetValue(WitResponseNode response)
  14. {
  15. return GetStringValue(response);
  16. }
  17. public override bool Equals(WitResponseNode response, object value)
  18. {
  19. if (value is string sValue)
  20. {
  21. return GetStringValue(response) == sValue;
  22. }
  23. return "" + value == GetStringValue(response);
  24. }
  25. public string GetStringValue(WitResponseNode response)
  26. {
  27. return Reference.GetStringValue(response);
  28. }
  29. }
  30. }