SCItem.cs 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112
  1. namespace Aitex.Core.RT.SCCore
  2. {
  3. public class SCConfigItem
  4. {
  5. public SccfgTypeEnum SccfgType { get; set; }
  6. public string Name { get; set; }
  7. public string Path { get; set; }
  8. public string Default { get; set; }
  9. public string Min { get; set; }
  10. public string Max { get; set; }
  11. public string Unit { get; set; }
  12. public string Type { get; set; }
  13. public string Tag { get; set; }
  14. public string Parameter { get; set; }
  15. public string Description { get; set; }
  16. public object Value
  17. {
  18. get
  19. {
  20. switch (Type)
  21. {
  22. case "Bool":
  23. return BoolValue;
  24. case "Double":
  25. return DoubleValue;
  26. case "String":
  27. return StringValue;
  28. case "Integer":
  29. return IntValue;
  30. default:
  31. return null;
  32. }
  33. }
  34. }
  35. public Type Typeof
  36. {
  37. get
  38. {
  39. switch (Type)
  40. {
  41. case "Bool":
  42. return typeof(bool);
  43. case "Double":
  44. return typeof(double);
  45. case "String":
  46. return typeof(string);
  47. case "Integer":
  48. return typeof(int);
  49. default:
  50. return null;
  51. }
  52. }
  53. }
  54. public string PathName
  55. {
  56. get { return string.IsNullOrEmpty(Path) ? Name : (Path + "." + Name); }
  57. }
  58. public int IntValue { get; set; }
  59. public double DoubleValue { get; set; }
  60. public bool BoolValue { get; set; }
  61. public string StringValue { get; set; }
  62. public SCConfigItem Clone()
  63. {
  64. return new SCConfigItem()
  65. {
  66. Name = this.Name,
  67. Path = this.Path,
  68. Default = this.Default,
  69. Min = this.Min,
  70. Max = this.Max,
  71. Unit = this.Unit,
  72. Type = this.Type,
  73. Tag = this.Tag,
  74. Parameter = this.Parameter,
  75. Description = this.Description,
  76. StringValue = this.StringValue,
  77. IntValue = this.IntValue,
  78. DoubleValue = this.DoubleValue,
  79. BoolValue = this.BoolValue,
  80. };
  81. }
  82. }
  83. /// <summary>
  84. /// 用来区分sc文件是否隐藏,以及是否以defalut为准
  85. /// </summary>
  86. public enum SccfgTypeEnum
  87. {
  88. Show = 10,//UI展示
  89. DefaultValue = 20,//UI不展示,且以配置文件Default值为准,修改后重启软件即可生效
  90. SetValue = 30,//UI不展示,以Value值为准
  91. }
  92. public enum SCConfigType
  93. {
  94. String,
  95. Integer,
  96. Bool,
  97. Double,
  98. List,
  99. }
  100. }