MySecurity.cs 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Text;
  4. namespace SysSecLibs
  5. {
  6. public class MySecurity
  7. {
  8. public static bool IsMachineValidated()
  9. {
  10. bool lbRetVal = false;
  11. if (!lbRetVal)
  12. {
  13. string text1 = FileFuns.ReadSystemLicense();
  14. Array array1 = Utils.StrToArrayEx(text1, "\r\n");
  15. string text2 = "";
  16. string text3 = "";
  17. foreach (string text4 in array1)
  18. {
  19. if (text4 != "")
  20. {
  21. Array array2 = Utils.StrToArray(text4);
  22. string text5 = array2.GetValue(0).ToString();
  23. string text6 = "";
  24. if ((array2.Length == 2) && (text5 == ""))
  25. {
  26. text5 = array2.GetValue(1).ToString();
  27. if (text2 == "")
  28. {
  29. text2 = Utils. GetCpuId();
  30. }
  31. text6 = text2;
  32. }
  33. else
  34. {
  35. if (text3 == "")
  36. {
  37. text3 = Utils.GetMachineMac();
  38. }
  39. text6 = text3;
  40. }
  41. lbRetVal = CheckMachineIds(text5, text6);
  42. }
  43. if (lbRetVal)
  44. {
  45. break;
  46. }
  47. }
  48. }
  49. return lbRetVal;
  50. }
  51. private static bool CheckMachineIds(string pcMachineId, string pcHardWardIds)
  52. {
  53. bool lbRetVal = false;
  54. Array array1 = Utils.StrToArray(pcHardWardIds);
  55. foreach (string text1 in array1)
  56. {
  57. if (text1 == pcMachineId)
  58. {
  59. return true;
  60. }
  61. }
  62. return lbRetVal;
  63. }
  64. }
  65. }