You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

87 lines
2.1 KiB

2 years ago
  1. using Euro.Transfer.Base;
  2. using System;
  3. using System.Collections.Generic;
  4. using System.Collections.Specialized;
  5. using System.Linq;
  6. using System.Text;
  7. using System.Threading.Tasks;
  8. namespace Euro.Transfer.Jobs.Transfer
  9. {
  10. public class Config : ServiceConfig
  11. {
  12. #region 基本属性
  13. private string mDescription;
  14. private string mEnabled;
  15. private string mAssembly;
  16. private int mInterval;
  17. /// <summary>
  18. /// 说明
  19. /// </summary>
  20. public override string Description
  21. {
  22. get { return this.mDescription; }
  23. }
  24. /// <summary>
  25. /// 是否开启
  26. /// </summary>
  27. public override string Enabled
  28. {
  29. get { return this.mEnabled; }
  30. }
  31. /// <summary>
  32. /// 处理程序集
  33. /// </summary>
  34. public override string Assembly
  35. {
  36. get { return this.mAssembly; }
  37. }
  38. /// <summary>
  39. /// 间隔时间
  40. /// </summary>
  41. public override int Interval
  42. {
  43. get { return this.mInterval; }
  44. }
  45. #endregion
  46. #region 构造函数
  47. /// <summary>
  48. /// 构造函数,将配置项加载进对象
  49. /// </summary>
  50. public Config()
  51. {
  52. var nvc = ServiceTools.GetSection(nameof(Transfer));
  53. foreach (string s in nvc.Keys)
  54. {
  55. switch (s.ToLower())
  56. {
  57. //基本
  58. case "description":
  59. this.mDescription = nvc[s].ToString();
  60. break;
  61. case "enabled":
  62. this.mEnabled = nvc[s].ToString();
  63. break;
  64. case "assembly":
  65. this.mAssembly = nvc[s].ToString();
  66. break;
  67. case "interval":
  68. this.mInterval = int.Parse(nvc[s].ToString());
  69. break;
  70. }
  71. }
  72. }
  73. #endregion
  74. }
  75. }