MessageProxy.cs 636 B

12345678910111213141516171819202122232425262728293031
  1. using System;
  2. namespace ET
  3. {
  4. public class MessageProxy: IMHandler
  5. {
  6. private readonly Type type;
  7. private readonly Action<Session, object> action;
  8. public MessageProxy(Type type, Action<Session, object> action)
  9. {
  10. this.type = type;
  11. this.action = action;
  12. }
  13. public void Handle(Session session, object message)
  14. {
  15. this.action.Invoke(session, message);
  16. }
  17. public Type GetMessageType()
  18. {
  19. return this.type;
  20. }
  21. public Type GetResponseType()
  22. {
  23. return null;
  24. }
  25. }
  26. }