SC.cs 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  1. using System;
  2. using System.Collections.Generic;
  3. using Aitex.Core.RT.ConfigCenter;
  4. using Aitex.Core.RT.IOCore;
  5. using MECF.Framework.Common.SCCore;
  6. namespace Aitex.Core.RT.SCCore
  7. {
  8. public static class SC
  9. {
  10. public static ISCManager Manager { set; private get; }
  11. public static void SetItemValue(string name, object value)
  12. {
  13. if (Manager != null)
  14. Manager.SetItemValue(name, value);
  15. }
  16. public static void SetItemValueStringFormat(string name, string value)
  17. {
  18. if (Manager != null)
  19. Manager.SetItemValueStringFormat(name, value);
  20. }
  21. public static void SetItemValue(string name, bool value)
  22. {
  23. if (Manager != null)
  24. Manager.SetItemValue(name, value);
  25. }
  26. public static void SetItemValue(string name, int value)
  27. {
  28. if (Manager != null)
  29. Manager.SetItemValue(name, value);
  30. }
  31. public static void SetItemValue(string name, double value)
  32. {
  33. if (Manager != null)
  34. Manager.SetItemValue(name, value);
  35. }
  36. public static void SetItemValue(string name, string value)
  37. {
  38. if (Manager != null)
  39. Manager.SetItemValue(name, value);
  40. }
  41. public static void SetItemValueFromString(string name, string value)
  42. {
  43. if (Manager != null)
  44. Manager.SetItemValueFromString(name, value);
  45. }
  46. public static SCConfigItem GetConfigItem(string name)
  47. {
  48. if (Manager != null)
  49. return Manager.GetConfigItem(name);
  50. return null;
  51. }
  52. public static bool ContainsItem(string name)
  53. {
  54. if (Manager != null)
  55. return Manager.ContainsItem(name);
  56. return false;
  57. }
  58. public static SCConfigItem GetConfigItem(string path, string name)
  59. {
  60. return GetConfigItem(path+"."+name);
  61. }
  62. public static T GetValue<T>(string name) where T : struct
  63. {
  64. if (Manager != null)
  65. return Manager.GetValue<T>(name);
  66. return default(T);
  67. }
  68. public static string GetStringValue(string name)
  69. {
  70. if (Manager != null)
  71. return Manager.GetStringValue(name);
  72. return null;
  73. }
  74. public static List<SCConfigItem> GetItemList()
  75. {
  76. if (Manager != null)
  77. return Manager.GetItemList();
  78. return null;
  79. }
  80. public static string GetConfigFileContent( )
  81. {
  82. if (Manager != null)
  83. return Manager.GetFileContent();
  84. return "";
  85. }
  86. }
  87. }