You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

35 lines
1.1 KiB

  1. using GBNewEnergy.Protocol.Enums;
  2. using GBNewEnergy.Protocol.UpStream;
  3. using System;
  4. using System.Collections.Generic;
  5. using System.Text;
  6. namespace GBNewEnergy.Protocol
  7. {
  8. public class NEBodiesFactory
  9. {
  10. /// <summary>
  11. /// 通过命令id获取数据体
  12. /// </summary>
  13. /// <param name="msgId"></param>
  14. /// <param name="buf"></param>
  15. /// <returns></returns>
  16. public static NEBodies GetNEBodiesByMsgId(NEMsgId msgId,byte[] buf, NEGlobalConfigs nEConfigs)
  17. {
  18. switch (msgId)
  19. {
  20. case NEMsgId.login:
  21. return new NELoginUpStream(buf, nEConfigs);
  22. case NEMsgId.loginout:
  23. return new NELogoutUpStream(buf, nEConfigs);
  24. case NEMsgId.platformlogin:
  25. return new NEPlatformLoginUpStream(buf, nEConfigs);
  26. case NEMsgId.platformlogout:
  27. return new NEPlatformLogoutUpStream(buf, nEConfigs);
  28. default:
  29. return null;
  30. }
  31. }
  32. }
  33. }