Advertisement
saadimran

GSArray.cs

Apr 2nd, 2012
155
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.49 KB | None | 0 0
  1. public class GSArray
  2. {
  3. private List<GSWrappedObject> Data;
  4.  
  5. public GSArray()
  6. {
  7. Data = new List<GSWrappedObject>();
  8. }
  9.  
  10. /// <summary>
  11. /// Returns this object in GS binary format.
  12. /// </summary>
  13. /// <returns></returns>
  14. public byte[] ToGSBinary()
  15. {
  16. List<byte> bytes = new List<byte>();
  17. short length = (short)Data.Count;
  18.  
  19. bytes.AddRange(length.ToGSBinary());
  20. for (int i = 0; i < length; i++)
  21. bytes.AddRange(Data[i].ToGSBinary());
  22.  
  23. return bytes.ToArray();
  24. }
  25.  
  26. bool Contains(object obj);
  27. void RemoveElementAt(int index);
  28.  
  29. #region Adders
  30.  
  31. void Add(GSWrappedObject value);
  32.  
  33. void AddNull();
  34.  
  35. void AddBool(bool value);
  36. void AddBoolArray(IEnumerable<bool> value);
  37.  
  38. void AddByte(byte value);
  39. void AddByteArray(IEnumerable<byte> value);
  40.  
  41. void AddShort(short value);
  42. void AddShortArray(IEnumerable<short> value);
  43.  
  44. void AddInt(int value);
  45. void AddIntArray(IEnumerable<int> value);
  46.  
  47. void AddLong(long value);
  48. void AddLongArray(IEnumerable<long> value);
  49.  
  50. void AddFloat(float value);
  51. void AddFloatArray(IEnumerable<float> value);
  52.  
  53. void AddDouble(double value);
  54. void AddDoubleArray(IEnumerable<double> value);
  55.  
  56. void AddString(string value);
  57. void AddStringArray(IEnumerable<string> value);
  58.  
  59. void AddGSArray(IGSArray value);
  60. void AddGSObject(IGSObject value);
  61.  
  62. #endregion
  63.  
  64. #region Getters
  65.  
  66. GSWrappedObject GetElementAt(int index);
  67.  
  68. bool IsNull(int index);
  69.  
  70. bool GetBool(int index);
  71. bool[] GetBoolArray(int index);
  72.  
  73. byte GetByte(int index);
  74. byte[] GetByteArray(int index);
  75.  
  76. short GetShort(int index);
  77. short[] GetShortArray(int index);
  78.  
  79. int GetInt(int index);
  80. int[] GetIntArray(int index);
  81.  
  82. long GetLong(int index);
  83. long[] GetLongArray(int index);
  84.  
  85. float GetFloat(int index);
  86. float[] GetFloatArray(int index);
  87.  
  88. double GetDouble(int index);
  89. double[] GetDoubleArray(int index);
  90.  
  91. string GetString(int index);
  92. string[] GetStringArray(int index);
  93.  
  94. IGSArray GetGSArray(int index);
  95. IGSObject GetGSObject(int index);
  96. #endregion
  97. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement