AcsUtil.cs 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. using System.Text.RegularExpressions;
  2. namespace DeviceCenter
  3. {
  4. class AcsUtil
  5. {
  6. public static string getCardNo(string input)
  7. {
  8. string pattern = @"\+Card Number\:(\d+)\+";
  9. try
  10. {
  11. return Regex.Matches(input, pattern)[0].Groups[1].Value;
  12. }
  13. catch
  14. {
  15. return null;
  16. }
  17. }
  18. public static string getDoorNo(string input)
  19. {
  20. string pattern = @"\+Door Number\:(\d+)\+";
  21. try
  22. {
  23. return Regex.Matches(input, pattern)[0].Groups[1].Value;
  24. }
  25. catch
  26. {
  27. return null;
  28. }
  29. }
  30. public static string getChannel(string input)
  31. {
  32. string pattern = @"\+wAccessChannel\:(\d+)\+";
  33. try
  34. {
  35. return Regex.Matches(input, pattern)[0].Groups[1].Value;
  36. }
  37. catch
  38. {
  39. return null;
  40. }
  41. }
  42. public static string getCardReaderNo(string input)
  43. {
  44. string pattern = @"\+Card Reader Number\:(\d+)\+";
  45. try
  46. {
  47. return Regex.Matches(input, pattern)[0].Groups[1].Value;
  48. }
  49. catch
  50. {
  51. return null;
  52. }
  53. }
  54. public static string getPicturePath(string input)
  55. {
  56. string pattern = @"SavePath\:(.+\.bmp)";
  57. try
  58. {
  59. return Regex.Matches(input, pattern)[0].Groups[1].Value;
  60. }
  61. catch
  62. {
  63. return null;
  64. }
  65. }
  66. }
  67. }