ReleaseList.cs 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125
  1. using System;
  2. using System.Collections;
  3. using System.Xml;
  4. namespace Common
  5. {
  6. public class ReleaseList : XmlDocument
  7. {
  8. private string _Description = "";
  9. private string _ReleaseDate = "";
  10. private IList _ReleaseFiles;
  11. private string _ReleaseVersion = "";
  12. private string _ReleaseReason = "";
  13. public ReleaseList(string FileNameAll)
  14. {
  15. this.Init(FileNameAll);
  16. }
  17. public XmlNode FindNode(string xPath)
  18. {
  19. return base.SelectSingleNode(xPath);
  20. }
  21. public XmlNodeList GetNodeList(string xPath)
  22. {
  23. return base.SelectSingleNode(xPath).ChildNodes;
  24. }
  25. public string GetNodeValue(string xPath)
  26. {
  27. return base.SelectSingleNode(xPath).InnerText;
  28. }
  29. private void Init(string FileNameAll)
  30. {
  31. try
  32. {
  33. this.Load(FileNameAll);
  34. this._Description = this.GetNodeValue("AutoUpdater/Description");
  35. this._ReleaseDate = this.GetNodeValue("AutoUpdater/ReleaseDate");
  36. this._ReleaseVersion = this.GetNodeValue("AutoUpdater/ReleaseVersion");
  37. this._ReleaseReason = this.GetNodeValue("AutoUpdater/ReleaseReason");
  38. this._ReleaseFiles = new ArrayList();
  39. foreach (XmlNode node in this.GetNodeList("AutoUpdater/Releases"))
  40. {
  41. ReleaseFile file = new ReleaseFile();
  42. file.FileName = node.Attributes["FileName"].Value.Trim();
  43. file.Version = node.Attributes["Version"].Value.Trim();
  44. file.ReleaseDate = node.Attributes["ReleaseDate"].Value.Trim();
  45. file.Size = node.Attributes["Size"].Value.Trim();
  46. this._ReleaseFiles.Add(file);
  47. }
  48. }
  49. catch
  50. {
  51. }
  52. }
  53. public string Description
  54. {
  55. get
  56. {
  57. return this._Description;
  58. }
  59. set
  60. {
  61. this._Description = value;
  62. }
  63. }
  64. public string ReleaseDate
  65. {
  66. get
  67. {
  68. return this._ReleaseDate;
  69. }
  70. set
  71. {
  72. this._ReleaseDate = value;
  73. }
  74. }
  75. public IList ReleaseFiles
  76. {
  77. get
  78. {
  79. return this._ReleaseFiles;
  80. }
  81. set
  82. {
  83. this._ReleaseFiles = value;
  84. }
  85. }
  86. public string ReleaseVersion
  87. {
  88. get
  89. {
  90. return this._ReleaseVersion;
  91. }
  92. set
  93. {
  94. this._ReleaseVersion = value;
  95. }
  96. }
  97. public string ReleaseReason
  98. {
  99. get
  100. {
  101. return this._ReleaseReason;
  102. }
  103. set
  104. {
  105. this._ReleaseReason = value;
  106. }
  107. }
  108. }
  109. }