AcsUtil.cs 1.7 KB

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