JsonDotNetEncoder.cs 1021 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. #if !BESTHTTP_DISABLE_SIGNALR_CORE && !BESTHTTP_DISABLE_WEBSOCKET
  2. using System;
  3. namespace BestHTTP.SignalRCore.Encoders
  4. {
  5. /*public sealed class JsonDotNetEncoder : BestHTTP.SignalRCore.IEncoder
  6. {
  7. public string Name { get { return "json"; } }
  8. public object ConvertTo(Type toType, object obj)
  9. {
  10. string json = Newtonsoft.Json.JsonConvert.SerializeObject(obj);
  11. return Newtonsoft.Json.JsonConvert.DeserializeObject(json, toType);
  12. }
  13. public T DecodeAs<T>(string text)
  14. {
  15. return Newtonsoft.Json.JsonConvert.DeserializeObject<T>(text);
  16. }
  17. public T DecodeAs<T>(byte[] data)
  18. {
  19. throw new NotImplementedException();
  20. }
  21. public byte[] EncodeAsBinary<T>(T value)
  22. {
  23. throw new NotImplementedException();
  24. }
  25. public string EncodeAsText<T>(T value)
  26. {
  27. return Newtonsoft.Json.JsonConvert.SerializeObject(value);
  28. }
  29. }*/
  30. }
  31. #endif