Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public interface ISocketMessageParser
- {
- bool AppliesTo(SocketMessage message);
- object Parse(Type type, SocketMessage message);
- }
- public class DefaultSocketMessageParser : ISocketMessageParser
- {
- private readonly IJsonService _jsonService;
- public DefaultSocketMessageParser(IJsonService jsonService)
- {
- _jsonService = jsonService;
- }
- public bool AppliesTo(SocketMessage message)
- {
- return true;
- }
- public object Parse(Type type, SocketMessage message)
- {
- return _jsonService.Deserialize(type, message.Message);
- }
- }
Add Comment
Please, Sign In to add comment