FileProgressStruct.cs 6.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230
  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 FileProgressStruct : IDisposable {
  12. private HandleRef swigCPtr;
  13. protected bool swigCMemOwn;
  14. internal FileProgressStruct(IntPtr cPtr, bool cMemoryOwn) {
  15. swigCMemOwn = cMemoryOwn;
  16. swigCPtr = new HandleRef(this, cPtr);
  17. }
  18. internal static HandleRef getCPtr(FileProgressStruct obj) {
  19. if (obj != null)
  20. {
  21. if (obj.firstDataChunkIsCached)
  22. {
  23. obj.SetFirstDataChunk(obj.firstDataChunk, obj.firstDataChunk.Length);
  24. }
  25. if (obj.iriDataChunkIsCached)
  26. {
  27. obj.SetIriDataChunk(obj.iriDataChunk, obj.iriDataChunk.Length);
  28. }
  29. obj.firstDataChunkIsCached=false;
  30. obj.iriDataChunkIsCached=false;
  31. }
  32. return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
  33. }
  34. ~FileProgressStruct() {
  35. Dispose();
  36. }
  37. public virtual void Dispose() {
  38. lock(this) {
  39. if (swigCPtr.Handle != IntPtr.Zero) {
  40. if (swigCMemOwn) {
  41. swigCMemOwn = false;
  42. RakNetPINVOKE.delete_FileProgressStruct(swigCPtr);
  43. }
  44. swigCPtr = new HandleRef(null, IntPtr.Zero);
  45. }
  46. GC.SuppressFinalize(this);
  47. }
  48. }
  49. private bool firstDataChunkIsCached = false;
  50. private byte[] firstDataChunkCache;
  51. private bool iriDataChunkIsCached = false;
  52. private byte[] iriDataChunkCache;
  53. public OnFileStruct onFileStruct {
  54. set {
  55. RakNetPINVOKE.FileProgressStruct_onFileStruct_set(swigCPtr, OnFileStruct.getCPtr(value));
  56. }
  57. get {
  58. IntPtr cPtr = RakNetPINVOKE.FileProgressStruct_onFileStruct_get(swigCPtr);
  59. OnFileStruct ret = (cPtr == IntPtr.Zero) ? null : new OnFileStruct(cPtr, false);
  60. return ret;
  61. }
  62. }
  63. public uint partCount {
  64. set {
  65. RakNetPINVOKE.FileProgressStruct_partCount_set(swigCPtr, value);
  66. }
  67. get {
  68. uint ret = RakNetPINVOKE.FileProgressStruct_partCount_get(swigCPtr);
  69. return ret;
  70. }
  71. }
  72. public uint partTotal {
  73. set {
  74. RakNetPINVOKE.FileProgressStruct_partTotal_set(swigCPtr, value);
  75. }
  76. get {
  77. uint ret = RakNetPINVOKE.FileProgressStruct_partTotal_get(swigCPtr);
  78. return ret;
  79. }
  80. }
  81. public uint dataChunkLength {
  82. set {
  83. RakNetPINVOKE.FileProgressStruct_dataChunkLength_set(swigCPtr, value);
  84. }
  85. get {
  86. uint ret = RakNetPINVOKE.FileProgressStruct_dataChunkLength_get(swigCPtr);
  87. return ret;
  88. }
  89. }
  90. public byte[] firstDataChunk {
  91. set
  92. {
  93. firstDataChunkCache=value;
  94. firstDataChunkIsCached = true;
  95. SetFirstDataChunk (value, value.Length);
  96. }
  97. get
  98. {
  99. byte[] returnArray;
  100. if (!firstDataChunkIsCached)
  101. {
  102. IntPtr cPtr = RakNetPINVOKE.FileProgressStruct_firstDataChunk_get (swigCPtr);
  103. int len = (int) dataChunkLength;
  104. if (len<=0)
  105. {
  106. return null;
  107. }
  108. returnArray = new byte[len];
  109. byte[] marshalArray = new byte[len];
  110. Marshal.Copy(cPtr, marshalArray, 0, len);
  111. marshalArray.CopyTo(returnArray, 0);
  112. firstDataChunkCache = returnArray;
  113. firstDataChunkIsCached = true;
  114. }
  115. else
  116. {
  117. returnArray = firstDataChunkCache;
  118. }
  119. return returnArray;
  120. }
  121. }
  122. public byte[] iriDataChunk {
  123. set
  124. {
  125. iriDataChunkCache=value;
  126. iriDataChunkIsCached = true;
  127. SetIriDataChunk (value, value.Length);
  128. }
  129. get
  130. {
  131. byte[] returnArray;
  132. if (!iriDataChunkIsCached)
  133. {
  134. IntPtr cPtr = RakNetPINVOKE.FileProgressStruct_iriDataChunk_get (swigCPtr);
  135. int len = (int) dataChunkLength;
  136. if (len<=0)
  137. {
  138. return null;
  139. }
  140. returnArray = new byte[len];
  141. byte[] marshalArray = new byte[len];
  142. Marshal.Copy(cPtr, marshalArray, 0, len);
  143. marshalArray.CopyTo(returnArray, 0);
  144. iriDataChunkCache = returnArray;
  145. iriDataChunkIsCached = true;
  146. }
  147. else
  148. {
  149. returnArray = iriDataChunkCache;
  150. }
  151. return returnArray;
  152. }
  153. }
  154. public uint iriWriteOffset {
  155. set {
  156. RakNetPINVOKE.FileProgressStruct_iriWriteOffset_set(swigCPtr, value);
  157. }
  158. get {
  159. uint ret = RakNetPINVOKE.FileProgressStruct_iriWriteOffset_get(swigCPtr);
  160. return ret;
  161. }
  162. }
  163. public SystemAddress senderSystemAddress {
  164. set {
  165. RakNetPINVOKE.FileProgressStruct_senderSystemAddress_set(swigCPtr, SystemAddress.getCPtr(value));
  166. }
  167. get {
  168. IntPtr cPtr = RakNetPINVOKE.FileProgressStruct_senderSystemAddress_get(swigCPtr);
  169. SystemAddress ret = (cPtr == IntPtr.Zero) ? null : new SystemAddress(cPtr, false);
  170. return ret;
  171. }
  172. }
  173. public RakNetGUID senderGuid {
  174. set {
  175. RakNetPINVOKE.FileProgressStruct_senderGuid_set(swigCPtr, RakNetGUID.getCPtr(value));
  176. }
  177. get {
  178. IntPtr cPtr = RakNetPINVOKE.FileProgressStruct_senderGuid_get(swigCPtr);
  179. RakNetGUID ret = (cPtr == IntPtr.Zero) ? null : new RakNetGUID(cPtr, false);
  180. return ret;
  181. }
  182. }
  183. public bool allocateIrIDataChunkAutomatically {
  184. set {
  185. RakNetPINVOKE.FileProgressStruct_allocateIrIDataChunkAutomatically_set(swigCPtr, value);
  186. }
  187. get {
  188. bool ret = RakNetPINVOKE.FileProgressStruct_allocateIrIDataChunkAutomatically_get(swigCPtr);
  189. return ret;
  190. }
  191. }
  192. public FileProgressStruct() : this(RakNetPINVOKE.new_FileProgressStruct(), true) {
  193. }
  194. private void SetFirstDataChunk(byte[] inByteArray, int numBytes) {
  195. RakNetPINVOKE.FileProgressStruct_SetFirstDataChunk(swigCPtr, inByteArray, numBytes);
  196. }
  197. private void SetIriDataChunk(byte[] inByteArray, int numBytes) {
  198. RakNetPINVOKE.FileProgressStruct_SetIriDataChunk(swigCPtr, inByteArray, numBytes);
  199. }
  200. }
  201. }
粤ICP备19079148号