RakNetStatistics.cs 9.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342
  1. /* ----------------------------------------------------------------------------
  2. * This file was automatically generated by SWIG (http://www.swig.org).
  3. * Version 2.0.1
  4. *
  5. * Do not make changes to this file unless you know what you are doing--modify
  6. * the SWIG interface file instead.
  7. * ----------------------------------------------------------------------------- */
  8. namespace RakNet {
  9. using System;
  10. using System.Runtime.InteropServices;
  11. public class RakNetStatistics : IDisposable {
  12. private HandleRef swigCPtr;
  13. protected bool swigCMemOwn;
  14. internal RakNetStatistics(IntPtr cPtr, bool cMemoryOwn) {
  15. swigCMemOwn = cMemoryOwn;
  16. swigCPtr = new HandleRef(this, cPtr);
  17. }
  18. internal static HandleRef getCPtr(RakNetStatistics obj) {
  19. if (obj != null)
  20. {
  21. if (obj.bytesInSendBufferIsCached)
  22. {
  23. obj.SetBytesInSendBuffer(obj.bytesInSendBuffer, obj.bytesInSendBuffer.Length);
  24. }
  25. if (obj.messageInSendBufferIsCached)
  26. {
  27. obj.SetMessageInSendBuffer(obj.messageInSendBuffer, obj.messageInSendBuffer.Length);
  28. }
  29. if (obj.runningTotalIsCached)
  30. {
  31. obj.SetRunningTotal(obj.runningTotal, obj.runningTotal.Length);
  32. }
  33. if (obj.valueOverLastSecondIsCached)
  34. {
  35. obj.SetValueOverLastSecond(obj.valueOverLastSecond, obj.valueOverLastSecond.Length);
  36. }
  37. obj.bytesInSendBufferIsCached=false;
  38. obj.messageInSendBufferIsCached=false;
  39. obj.runningTotalIsCached=false;
  40. obj.valueOverLastSecondIsCached=false;
  41. }
  42. return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
  43. }
  44. ~RakNetStatistics() {
  45. Dispose();
  46. }
  47. public virtual void Dispose() {
  48. lock(this) {
  49. if (swigCPtr.Handle != IntPtr.Zero) {
  50. if (swigCMemOwn) {
  51. swigCMemOwn = false;
  52. RakNetPINVOKE.delete_RakNetStatistics(swigCPtr);
  53. }
  54. swigCPtr = new HandleRef(null, IntPtr.Zero);
  55. }
  56. GC.SuppressFinalize(this);
  57. }
  58. }
  59. private bool bytesInSendBufferIsCached = false;
  60. private bool messageInSendBufferIsCached = false;
  61. private bool runningTotalIsCached = false;
  62. private bool valueOverLastSecondIsCached = false;
  63. private double[] bytesInSendBufferCache;
  64. private uint[] messageInSendBufferCache;
  65. private ulong[] runningTotalCache;
  66. private ulong[] valueOverLastSecondCache;
  67. public ulong[] valueOverLastSecond {
  68. set
  69. {
  70. valueOverLastSecondCache=value;
  71. valueOverLastSecondIsCached = true;
  72. SetValueOverLastSecond (value, value.Length);
  73. }
  74. get
  75. {
  76. ulong[] returnArray;
  77. if (!valueOverLastSecondIsCached)
  78. {
  79. IntPtr cPtr = RakNetPINVOKE.RakNetStatistics_valueOverLastSecond_get (swigCPtr);
  80. int len = (int) RNSPerSecondMetrics.RNS_PER_SECOND_METRICS_COUNT;
  81. if (len<=0)
  82. {
  83. return null;
  84. }
  85. returnArray = new ulong[len];
  86. long[] marshalArray = new long[len];
  87. Marshal.Copy(cPtr, marshalArray, 0, len);
  88. for (int i=0;i<len;i++)
  89. {
  90. returnArray[i]= (ulong) ( marshalArray[i] );
  91. }
  92. valueOverLastSecondCache = returnArray;
  93. valueOverLastSecondIsCached = true;
  94. }
  95. else
  96. {
  97. returnArray = valueOverLastSecondCache;
  98. }
  99. return returnArray;
  100. }
  101. }
  102. public ulong[] runningTotal {
  103. set
  104. {
  105. runningTotalCache=value;
  106. runningTotalIsCached = true;
  107. SetRunningTotal (value, value.Length);
  108. }
  109. get
  110. {
  111. ulong[] returnArray;
  112. if (!runningTotalIsCached)
  113. {
  114. IntPtr cPtr = RakNetPINVOKE.RakNetStatistics_runningTotal_get (swigCPtr);
  115. int len = (int) RNSPerSecondMetrics.RNS_PER_SECOND_METRICS_COUNT;
  116. if (len<=0)
  117. {
  118. return null;
  119. }
  120. returnArray = new ulong[len];
  121. long[] marshalArray = new long[len];
  122. Marshal.Copy(cPtr, marshalArray, 0, len);
  123. for (int i=0;i<len;i++)
  124. {
  125. returnArray[i]= (ulong) ( marshalArray[i] );
  126. }
  127. runningTotalCache = returnArray;
  128. runningTotalIsCached = true;
  129. }
  130. else
  131. {
  132. returnArray = runningTotalCache;
  133. }
  134. return returnArray;
  135. }
  136. }
  137. public ulong connectionStartTime {
  138. set {
  139. RakNetPINVOKE.RakNetStatistics_connectionStartTime_set(swigCPtr, value);
  140. }
  141. get {
  142. ulong ret = RakNetPINVOKE.RakNetStatistics_connectionStartTime_get(swigCPtr);
  143. return ret;
  144. }
  145. }
  146. public bool isLimitedByCongestionControl {
  147. set {
  148. RakNetPINVOKE.RakNetStatistics_isLimitedByCongestionControl_set(swigCPtr, value);
  149. }
  150. get {
  151. bool ret = RakNetPINVOKE.RakNetStatistics_isLimitedByCongestionControl_get(swigCPtr);
  152. return ret;
  153. }
  154. }
  155. public ulong BPSLimitByCongestionControl {
  156. set {
  157. RakNetPINVOKE.RakNetStatistics_BPSLimitByCongestionControl_set(swigCPtr, value);
  158. }
  159. get {
  160. ulong ret = RakNetPINVOKE.RakNetStatistics_BPSLimitByCongestionControl_get(swigCPtr);
  161. return ret;
  162. }
  163. }
  164. public bool isLimitedByOutgoingBandwidthLimit {
  165. set {
  166. RakNetPINVOKE.RakNetStatistics_isLimitedByOutgoingBandwidthLimit_set(swigCPtr, value);
  167. }
  168. get {
  169. bool ret = RakNetPINVOKE.RakNetStatistics_isLimitedByOutgoingBandwidthLimit_get(swigCPtr);
  170. return ret;
  171. }
  172. }
  173. public ulong BPSLimitByOutgoingBandwidthLimit {
  174. set {
  175. RakNetPINVOKE.RakNetStatistics_BPSLimitByOutgoingBandwidthLimit_set(swigCPtr, value);
  176. }
  177. get {
  178. ulong ret = RakNetPINVOKE.RakNetStatistics_BPSLimitByOutgoingBandwidthLimit_get(swigCPtr);
  179. return ret;
  180. }
  181. }
  182. public uint[] messageInSendBuffer {
  183. set
  184. {
  185. messageInSendBufferCache=value;
  186. messageInSendBufferIsCached = true;
  187. SetMessageInSendBuffer (value, value.Length);
  188. }
  189. get
  190. {
  191. uint[] returnArray;
  192. if (!messageInSendBufferIsCached)
  193. {
  194. IntPtr cPtr = RakNetPINVOKE.RakNetStatistics_messageInSendBuffer_get (swigCPtr);
  195. int len = (int) PacketPriority.NUMBER_OF_PRIORITIES;
  196. if (len<=0)
  197. {
  198. return null;
  199. }
  200. returnArray = new uint[len];
  201. int[] marshalArray = new int[len];
  202. Marshal.Copy(cPtr, marshalArray, 0, len);
  203. for (int i=0;i<len;i++)
  204. {
  205. returnArray[i]= (uint) ( marshalArray[i] );
  206. }
  207. messageInSendBufferCache = returnArray;
  208. messageInSendBufferIsCached = true;
  209. }
  210. else
  211. {
  212. returnArray = messageInSendBufferCache;
  213. }
  214. return returnArray;
  215. }
  216. }
  217. public double[] bytesInSendBuffer {
  218. set
  219. {
  220. bytesInSendBufferCache=value;
  221. bytesInSendBufferIsCached = true;
  222. SetBytesInSendBuffer (value, value.Length);
  223. }
  224. get
  225. {
  226. double[] returnArray;
  227. if (!bytesInSendBufferIsCached)
  228. {
  229. IntPtr cPtr = RakNetPINVOKE.RakNetStatistics_bytesInSendBuffer_get (swigCPtr);
  230. int len = (int) PacketPriority.NUMBER_OF_PRIORITIES;
  231. if (len<=0)
  232. {
  233. return null;
  234. }
  235. returnArray = new double[len];
  236. double[] marshalArray = new double[len];
  237. Marshal.Copy(cPtr, marshalArray, 0, len);
  238. for (int i=0;i<len;i++)
  239. {
  240. returnArray[i]= (double) ( marshalArray[i] );
  241. }
  242. bytesInSendBufferCache = returnArray;
  243. bytesInSendBufferIsCached = true;
  244. }
  245. else
  246. {
  247. returnArray = bytesInSendBufferCache;
  248. }
  249. return returnArray;
  250. }
  251. }
  252. public uint messagesInResendBuffer {
  253. set {
  254. RakNetPINVOKE.RakNetStatistics_messagesInResendBuffer_set(swigCPtr, value);
  255. }
  256. get {
  257. uint ret = RakNetPINVOKE.RakNetStatistics_messagesInResendBuffer_get(swigCPtr);
  258. return ret;
  259. }
  260. }
  261. public ulong bytesInResendBuffer {
  262. set {
  263. RakNetPINVOKE.RakNetStatistics_bytesInResendBuffer_set(swigCPtr, value);
  264. }
  265. get {
  266. ulong ret = RakNetPINVOKE.RakNetStatistics_bytesInResendBuffer_get(swigCPtr);
  267. return ret;
  268. }
  269. }
  270. public float packetlossLastSecond {
  271. set {
  272. RakNetPINVOKE.RakNetStatistics_packetlossLastSecond_set(swigCPtr, value);
  273. }
  274. get {
  275. float ret = RakNetPINVOKE.RakNetStatistics_packetlossLastSecond_get(swigCPtr);
  276. return ret;
  277. }
  278. }
  279. public float packetlossTotal {
  280. set {
  281. RakNetPINVOKE.RakNetStatistics_packetlossTotal_set(swigCPtr, value);
  282. }
  283. get {
  284. float ret = RakNetPINVOKE.RakNetStatistics_packetlossTotal_get(swigCPtr);
  285. return ret;
  286. }
  287. }
  288. public void SetBytesInSendBuffer(double[] inDoubleArray, int numDoubles) {
  289. RakNetPINVOKE.RakNetStatistics_SetBytesInSendBuffer(swigCPtr, inDoubleArray, numDoubles);
  290. }
  291. public void SetMessageInSendBuffer(uint[] inUnsignedIntArray, int numInts) {
  292. RakNetPINVOKE.RakNetStatistics_SetMessageInSendBuffer(swigCPtr, inUnsignedIntArray, numInts);
  293. }
  294. public void SetRunningTotal(ulong[] inUint64Array, int numUint64) {
  295. RakNetPINVOKE.RakNetStatistics_SetRunningTotal(swigCPtr, inUint64Array, numUint64);
  296. }
  297. public void SetValueOverLastSecond(ulong[] inUint64Array, int numUint64) {
  298. RakNetPINVOKE.RakNetStatistics_SetValueOverLastSecond(swigCPtr, inUint64Array, numUint64);
  299. }
  300. public RakNetStatistics() : this(RakNetPINVOKE.new_RakNetStatistics(), true) {
  301. }
  302. }
  303. }
粤ICP备19079148号