InitLotteryConfig.cs 991 B

123456789101112131415161718192021222324252627282930313233343536
  1. using System;
  2. using System.Collections.Generic;
  3. using Lottomat.Util;
  4. using Lottomat.Util.Extension;
  5. namespace Lottomat.Application.Code
  6. {
  7. /// <summary>
  8. /// 初始化开奖号配置文件
  9. /// </summary>
  10. public class InitLotteryConfig
  11. {
  12. private static List<SCCConfig> cache = null;
  13. private static readonly object _lock = new object();
  14. /// <summary>
  15. /// 初始化配置文件
  16. /// </summary>
  17. /// <returns></returns>
  18. public static List<SCCConfig> Init()
  19. {
  20. if (cache == null)
  21. {
  22. lock (_lock)
  23. {
  24. if (cache == null)
  25. {
  26. string configFile = AppDomain.CurrentDomain.BaseDirectory + "XmlConfig\\SCCConfig.xml";
  27. cache = configFile.ConvertXMLToObject<SCCConfig>("SCCSettings");
  28. }
  29. }
  30. }
  31. return cache;
  32. }
  33. }
  34. }