SCItem.cs 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  1. using System;
  2. using System.Diagnostics;
  3. using System.Xml.Serialization;
  4. using Aitex.Core.RT.Log;
  5. namespace Aitex.Core.RT.SCCore
  6. {
  7. public class SCConfigItem
  8. {
  9. public string Name { get; set; }
  10. public string Path { get; set; }
  11. public string Default { get; set; }
  12. public string Min { get; set; }
  13. public string Max { get; set; }
  14. public string Unit { get; set; }
  15. public string Type { get; set; }
  16. public string Tag { get; set; }
  17. public string Parameter { get; set; }
  18. public string Description { get; set; }
  19. public object Value
  20. {
  21. get
  22. {
  23. switch (Type)
  24. {
  25. case "Bool":
  26. return BoolValue;
  27. case "Double":
  28. return DoubleValue;
  29. case "String":
  30. return StringValue;
  31. case "Integer":
  32. return IntValue;
  33. default:
  34. return null;
  35. }
  36. }
  37. }
  38. public Type Typeof
  39. {
  40. get
  41. {
  42. switch (Type)
  43. {
  44. case "Bool":
  45. return typeof(bool);
  46. case "Double":
  47. return typeof(double);
  48. case "String":
  49. return typeof(string);
  50. case "Integer":
  51. return typeof(int);
  52. default:
  53. return null;
  54. }
  55. }
  56. }
  57. public string PathName
  58. {
  59. get { return string.IsNullOrEmpty(Path) ? Name : (Path + "." + Name); }
  60. }
  61. public int Index { get; set; }
  62. public int IntValue { get; set; }
  63. public double DoubleValue { get; set; }
  64. public bool BoolValue { get; set; }
  65. public string StringValue { get; set; }
  66. public SCConfigItem Clone()
  67. {
  68. return new SCConfigItem()
  69. {
  70. Name = this.Name,
  71. Path = this.Path,
  72. Default = this.Default,
  73. Min = this.Min,
  74. Max = this.Max,
  75. Unit = this.Unit,
  76. Type = this.Type,
  77. Tag = this.Tag,
  78. Parameter = this.Parameter,
  79. Description = this.Description,
  80. StringValue = this.StringValue,
  81. IntValue = this.IntValue,
  82. DoubleValue = this.DoubleValue,
  83. BoolValue = this.BoolValue,
  84. };
  85. }
  86. }
  87. public enum SCConfigType
  88. {
  89. String,
  90. Integer,
  91. Bool,
  92. Double,
  93. List,
  94. }
  95. }