Guest User

Untitled

a guest
Jan 21st, 2018
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.57 KB | None | 0 0
  1. public interface ISocketMessageParser
  2. {
  3. bool AppliesTo(SocketMessage message);
  4. object Parse(Type type, SocketMessage message);
  5. }
  6.  
  7. public class DefaultSocketMessageParser : ISocketMessageParser
  8. {
  9. private readonly IJsonService _jsonService;
  10.  
  11. public DefaultSocketMessageParser(IJsonService jsonService)
  12. {
  13. _jsonService = jsonService;
  14. }
  15.  
  16. public bool AppliesTo(SocketMessage message)
  17. {
  18. return true;
  19. }
  20.  
  21. public object Parse(Type type, SocketMessage message)
  22. {
  23. return _jsonService.Deserialize(type, message.Message);
  24. }
  25. }
Add Comment
Please, Sign In to add comment