电子药箱通讯服务端
Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.

UserInfoProtocol.cs 1.1KB

7 месяцев назад
12345678910111213141516171819202122232425262728293031323334353637383940
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6. namespace Rdh.SocketServer.Client.Models
  7. {
  8. public class UserInfoProtocol : ModelProtocol
  9. {
  10. public string? UserName { get; set; }
  11. public string? UserCode { get; set; }
  12. public string? CardCode { get; set; }
  13. public string? UserRole { get; set; }
  14. public override string GetContent()
  15. {
  16. return UserName
  17. + AddBlockContent(UserCode)
  18. + AddBlockContent(CardCode)
  19. + AddBlockContent(UserRole);
  20. }
  21. public override bool ParseContent(string content)
  22. {
  23. if (!base.ParseContent(content))
  24. {
  25. return false;
  26. }
  27. string[] blocks = EleMedKitProtocolHelper.GetContentBlocks(content);
  28. if (blocks.Length > 3)
  29. {
  30. UserName = blocks[0];
  31. UserCode = blocks[1];
  32. CardCode = blocks[2];
  33. UserRole = blocks[3];
  34. return true;
  35. }
  36. return false;
  37. }
  38. }
  39. }