Const.cs 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. /* ==============================================================================
  2. * 功能描述:Const
  3. * 创 建 者:Garrett
  4. * 创建日期:2019/1/29 11:49:28
  5. * ==============================================================================*/
  6. using System;
  7. using Update.Config;
  8. namespace Update
  9. {
  10. /// <summary>
  11. /// Const
  12. /// </summary>
  13. public class Const
  14. {
  15. public static string URL => ConfigUtils.GetAppSettingsConfig(nameof(Const.URL));
  16. public static string Key => ConfigUtils.GetAppSettingsConfig(nameof(Const.Key));
  17. //revit文件服务器id和密码
  18. public static readonly string RevitServiceId = ConfigUtils.GetAppSettingsConfig(nameof(Const.RevitServiceId));
  19. public static readonly string RevitServiceSecret = ConfigUtils.GetAppSettingsConfig(nameof(Const.RevitServiceSecret));
  20. //是否自动更新
  21. public static readonly bool IsAutoUpdate= ConvertToBoolean(ConfigUtils.GetAppSettingsConfig(nameof(Const.IsAutoUpdate)));
  22. private static bool ConvertToBoolean(string key)
  23. {
  24. bool result = false;
  25. try
  26. {
  27. result= Convert.ToBoolean(key);
  28. }
  29. catch (Exception e)
  30. {
  31. Console.WriteLine(e);
  32. }
  33. return result;
  34. }
  35. }
  36. }