XmlRpcValueArray.cs 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121
  1. /* This file is part of OpenSubtitles Handler
  2. A library that handle OpenSubtitles.org XML-RPC methods.
  3. Copyright © Ala Ibrahim Hadid 2013
  4. This program is free software: you can redistribute it and/or modify
  5. it under the terms of the GNU General Public License as published by
  6. the Free Software Foundation, either version 3 of the License, or
  7. (at your option) any later version.
  8. This program is distributed in the hope that it will be useful,
  9. but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  11. GNU General Public License for more details.
  12. You should have received a copy of the GNU General Public License
  13. along with this program. If not, see <http://www.gnu.org/licenses/>.
  14. */
  15. using System;
  16. using System.Collections.Generic;
  17. namespace XmlRpcHandler
  18. {
  19. public class XmlRpcValueArray : IXmlRpcValue
  20. {
  21. public XmlRpcValueArray() :
  22. base()
  23. {
  24. values = new List<IXmlRpcValue>();
  25. }
  26. public XmlRpcValueArray(object data) :
  27. base(data)
  28. {
  29. values = new List<IXmlRpcValue>();
  30. }
  31. public XmlRpcValueArray(string[] texts) :
  32. base()
  33. {
  34. values = new List<IXmlRpcValue>();
  35. foreach (string val in texts)
  36. {
  37. values.Add(new XmlRpcValueBasic(val));
  38. }
  39. }
  40. public XmlRpcValueArray(int[] ints) :
  41. base()
  42. {
  43. values = new List<IXmlRpcValue>();
  44. foreach (int val in ints)
  45. {
  46. values.Add(new XmlRpcValueBasic(val));
  47. }
  48. }
  49. public XmlRpcValueArray(double[] doubles) :
  50. base()
  51. {
  52. values = new List<IXmlRpcValue>();
  53. foreach (double val in doubles)
  54. {
  55. values.Add(new XmlRpcValueBasic(val));
  56. }
  57. }
  58. public XmlRpcValueArray(bool[] bools) :
  59. base()
  60. {
  61. values = new List<IXmlRpcValue>();
  62. foreach (bool val in bools)
  63. {
  64. values.Add(new XmlRpcValueBasic(val));
  65. }
  66. }
  67. public XmlRpcValueArray(long[] base24s) :
  68. base()
  69. {
  70. values = new List<IXmlRpcValue>();
  71. foreach (long val in base24s)
  72. {
  73. values.Add(new XmlRpcValueBasic(val));
  74. }
  75. }
  76. public XmlRpcValueArray(DateTime[] dates) :
  77. base()
  78. {
  79. values = new List<IXmlRpcValue>();
  80. foreach (var val in dates)
  81. {
  82. values.Add(new XmlRpcValueBasic(val));
  83. }
  84. }
  85. public XmlRpcValueArray(XmlRpcValueBasic[] basicValues) :
  86. base()
  87. {
  88. values = new List<IXmlRpcValue>();
  89. foreach (var val in basicValues)
  90. {
  91. values.Add(val);
  92. }
  93. }
  94. public XmlRpcValueArray(XmlRpcValueStruct[] structs) :
  95. base()
  96. {
  97. values = new List<IXmlRpcValue>();
  98. foreach (var val in structs)
  99. {
  100. values.Add(val);
  101. }
  102. }
  103. public XmlRpcValueArray(XmlRpcValueArray[] arrays) :
  104. base()
  105. {
  106. values = new List<IXmlRpcValue>();
  107. foreach (var val in arrays)
  108. {
  109. values.Add(val);
  110. }
  111. }
  112. private List<IXmlRpcValue> values;
  113. public List<IXmlRpcValue> Values { get { return values; } set { values = value; } }
  114. }
  115. }