Model.cs 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6. using System.Xml.Serialization;
  7. namespace NewRockSdk.Tests
  8. {
  9. [Serializable]
  10. [XmlRoot(ElementName = "Control")]
  11. public class Model
  12. {
  13. [XmlAttribute("attribute")]
  14. public string Attribute { get; set; }
  15. [XmlElement]
  16. public string DeviceInfo { get; set; }
  17. }
  18. [Serializable]
  19. [XmlRoot(ElementName = "DeviceInfo")]
  20. public class QueryDeviceInfoResponse1
  21. {
  22. [XmlElement("manufacturer")]
  23. public string Manufacturer { get; set; }
  24. [XmlElement("model")]
  25. public string Model { get; set; }
  26. [XmlElement("version")]
  27. public string Version { get; set; }
  28. [XmlElement("mac")]
  29. public string Mac { get; set; }
  30. [XmlArray("devices")]
  31. [XmlArrayItem("ext", typeof(Ext), NestingLevel = 0),
  32. XmlArrayItem("line", typeof(Line), NestingLevel = 0),
  33. XmlArrayItem("group", typeof(Group), NestingLevel = 0),
  34. XmlArrayItem("ext", typeof(Ext), NestingLevel = 1)]
  35. public List<Device> Devices { get; set; }
  36. }
  37. //[XmlInclude(typeof(Ext)), XmlInclude(typeof(Line)),]
  38. public class Device
  39. {
  40. [XmlAttribute("lineid")]
  41. public string LineId { get; set; }
  42. [XmlAttribute("id")]
  43. public string Id { get; set; }
  44. }
  45. public class Ext : Device
  46. {
  47. }
  48. public class Line : Device
  49. {
  50. }
  51. public class Group : Device
  52. {
  53. public Ext Ext { get; set; }
  54. }
  55. [Serializable]
  56. [XmlRoot(ElementName = "DeviceInfo")]
  57. public class QueryDeviceInfoResponse2
  58. {
  59. [XmlElement("manufacturer")]
  60. public string Manufacturer { get; set; }
  61. [XmlElement("model")]
  62. public string Model { get; set; }
  63. [XmlElement("version")]
  64. public string Version { get; set; }
  65. [XmlElement("mac")]
  66. public string Mac { get; set; }
  67. [XmlElement("devices")]
  68. public Device1 Devices { get; set; }
  69. }
  70. public class Device1
  71. {
  72. [XmlElement("ext")]
  73. public Ext1[] Ext1s { get; set; }
  74. [XmlElement("line")]
  75. public Line1[] Line1s{ get; set; }
  76. [XmlElement("group")]
  77. public Group1[] Group1s { get; set; }
  78. }
  79. public class Group1
  80. {
  81. [XmlAttribute("id")]
  82. public string Id { get; set; }
  83. [XmlElement("ext")]
  84. public Ext1[] Ext1 { get; set; }
  85. }
  86. public class Line1
  87. {
  88. [XmlAttribute("lineid")]
  89. public string LineId { get; set; }
  90. [XmlAttribute("id")]
  91. public string Id { get; set; }
  92. }
  93. public class Ext1
  94. {
  95. [XmlAttribute("lineid")]
  96. public string LineId { get; set; }
  97. [XmlAttribute("id")]
  98. public string Id { get; set; }
  99. }
  100. }