saadimran

GSBitConverter.cs

Apr 2nd, 2012
51
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. public class GSObject
  2. {
  3. private Dictionary<string, GSWrappedObject> Data;
  4.  
  5. public GSObject()
  6. {
  7. Data = new Dictionary<string, GSWrappedObject>();
  8. }
  9.  
  10. /// <summary>
  11. /// Returns this object in the 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. {
  22. KeyValuePair<string, GSWrappedObject> elem = Data.ElementAt(i);
  23. bytes.AddRange(elem.Key.ToGSBinary());
  24. bytes.AddRange(elem.Value.ToGSBinary());
  25. }
  26.  
  27. return bytes.ToArray();
  28. }
  29.  
  30. bool ContainsKey(string key);
  31. void Detach(string key);
  32.  
  33. #region Attachers
  34.  
  35. void Attach(string key, GSWrappedObject value);
  36.  
  37. void AttachBool(string key, bool value);
  38. void AttachBoolArray(string key, IEnumerable<bool> value);
  39.  
  40. void AttachByte(string key, byte value);
  41. void AttachByteArray(string key, IEnumerable<byte> value);
  42.  
  43. void AttachShort(string key, short value);
  44. void AttachShortArray(string key, IEnumerable<short> value);
  45.  
  46. void AttachInt(string key, int value);
  47. void AttachIntArray(string key, IEnumerable<int> value);
  48.  
  49. void AttachLong(string key, long value);
  50. void AttachLongArray(string key, IEnumerable<long> value);
  51.  
  52. void AttachFloat(string key, float value);
  53. void AttachFloatArray(string key, IEnumerable<float> value);
  54.  
  55. void AttachDouble(string key, double value);
  56. void AttachDoubleArray(string key, IEnumerable<double> value);
  57.  
  58. void AttachString(string key, string value);
  59. void AttachStringArray(string key, IEnumerable<string> value);
  60.  
  61. void AttachGSArray(string key, IGSArray value);
  62. void AttachGSObject(string key, IGSObject value);
  63.  
  64. #endregion
  65.  
  66. #region Getters
  67.  
  68. GSWrappedObject Get(string key);
  69.  
  70. bool GetBool(string key);
  71. bool[] GetBoolArray(string key);
  72.  
  73. byte GetByte(string key);
  74. byte[] GetByteArray(string key);
  75.  
  76. short GetShort(string key);
  77. short[] GetShortArray(string key);
  78.  
  79. int GetInt(string key);
  80. int[] GetIntArray(string key);
  81.  
  82. long GetLong(string key);
  83. long[] GetLongArray(string key);
  84.  
  85. float GetFloat(string key);
  86. float[] GetFloatArray(string key);
  87.  
  88. double GetDouble(string key);
  89. double[] GetDoubleArray(string key);
  90.  
  91. string GetString(string key);
  92. string[] GetStringArray(string key);
  93.  
  94. IGSArray GetGSArray(string key);
  95. IGSObject GetGSObject(string key);
  96.  
  97. #endregion
  98. }
RAW Paste Data

Adblocker detected! Please consider disabling it...

We've detected AdBlock Plus or some other adblocking software preventing Pastebin.com from fully loading.

We don't have any obnoxious sound, or popup ads, we actively block these annoying types of ads!

Please add Pastebin.com to your ad blocker whitelist or disable your adblocking software.

×