YUtilsAuth.cs 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. //************************************************************************
  2. // https://github.com/yuzhengyang
  3. // author: yuzhengyang
  4. // date: 2017.9.12 - 2017.9.12
  5. // desc: 工具类验证
  6. // Copyright (c) yuzhengyang. All rights reserved.
  7. //************************************************************************
  8. using System;
  9. using System.Collections.Generic;
  10. using System.Linq;
  11. using System.Text;
  12. using System.Threading.Tasks;
  13. using System.Windows.Forms;
  14. namespace Y.Utils.YUtils
  15. {
  16. public class YUtilsAuth
  17. {
  18. private static bool IsStart = false;
  19. private static DateTime StartTime = DateTime.Now;
  20. /// <summary>
  21. /// 工具类验证
  22. /// </summary>
  23. public static void Check()
  24. {
  25. //if (!IsStart)
  26. //{
  27. // IsStart = true;
  28. // if (IsStart)
  29. // {
  30. // StartTime = DateTime.Now;
  31. // Task.Factory.StartNew(() =>
  32. // {
  33. // CheckObsolete();
  34. // });
  35. // }
  36. //}
  37. }
  38. /// <summary>
  39. /// 验证有效期
  40. /// </summary>
  41. private static void CheckObsolete()
  42. {
  43. if (DateTime.Now > new DateTime(2018, 12, 2, 0, 0, 0))
  44. MessageBox.Show(
  45. "工具组件超出有效期,请更新工具组件。(https://github.com/yuzhengyang)",
  46. "Beyond the service period");
  47. }
  48. }
  49. }