OnFileStruct.cs 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204
  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 OnFileStruct : IDisposable {
  12. private HandleRef swigCPtr;
  13. protected bool swigCMemOwn;
  14. internal OnFileStruct(IntPtr cPtr, bool cMemoryOwn) {
  15. swigCMemOwn = cMemoryOwn;
  16. swigCPtr = new HandleRef(this, cPtr);
  17. }
  18. internal static HandleRef getCPtr(OnFileStruct obj) {
  19. return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
  20. }
  21. ~OnFileStruct() {
  22. Dispose();
  23. }
  24. public virtual void Dispose() {
  25. lock(this) {
  26. if (swigCPtr.Handle != IntPtr.Zero) {
  27. if (swigCMemOwn) {
  28. swigCMemOwn = false;
  29. RakNetPINVOKE.delete_OnFileStruct(swigCPtr);
  30. }
  31. swigCPtr = new HandleRef(null, IntPtr.Zero);
  32. }
  33. GC.SuppressFinalize(this);
  34. }
  35. }
  36. private bool fileDataIsCached = false;
  37. private byte[] fileDataCache;
  38. public uint fileIndex {
  39. set {
  40. RakNetPINVOKE.OnFileStruct_fileIndex_set(swigCPtr, value);
  41. }
  42. get {
  43. uint ret = RakNetPINVOKE.OnFileStruct_fileIndex_get(swigCPtr);
  44. return ret;
  45. }
  46. }
  47. public string fileName {
  48. set {
  49. RakNetPINVOKE.OnFileStruct_fileName_set(swigCPtr, value);
  50. }
  51. get {
  52. string ret = RakNetPINVOKE.OnFileStruct_fileName_get(swigCPtr);
  53. return ret;
  54. }
  55. }
  56. public byte[] fileData {
  57. set
  58. {
  59. fileDataCache=value;
  60. fileDataIsCached = true;
  61. SetFileData (value, value.Length);
  62. }
  63. get
  64. {
  65. byte[] returnArray;
  66. if (!fileDataIsCached)
  67. {
  68. IntPtr cPtr = RakNetPINVOKE.OnFileStruct_fileData_get (swigCPtr);
  69. int len = (int) byteLengthOfThisFile;
  70. if (len<=0)
  71. {
  72. return null;
  73. }
  74. returnArray = new byte[len];
  75. byte[] marshalArray = new byte[len];
  76. Marshal.Copy(cPtr, marshalArray, 0, len);
  77. marshalArray.CopyTo(returnArray, 0);
  78. fileDataCache = returnArray;
  79. fileDataIsCached = true;
  80. }
  81. else
  82. {
  83. returnArray = fileDataCache;
  84. }
  85. return returnArray;
  86. }
  87. }
  88. public uint byteLengthOfThisFile {
  89. set {
  90. RakNetPINVOKE.OnFileStruct_byteLengthOfThisFile_set(swigCPtr, value);
  91. }
  92. get {
  93. uint ret = RakNetPINVOKE.OnFileStruct_byteLengthOfThisFile_get(swigCPtr);
  94. return ret;
  95. }
  96. }
  97. public uint bytesDownloadedForThisFile {
  98. set {
  99. RakNetPINVOKE.OnFileStruct_bytesDownloadedForThisFile_set(swigCPtr, value);
  100. }
  101. get {
  102. uint ret = RakNetPINVOKE.OnFileStruct_bytesDownloadedForThisFile_get(swigCPtr);
  103. return ret;
  104. }
  105. }
  106. public ushort setID {
  107. set {
  108. RakNetPINVOKE.OnFileStruct_setID_set(swigCPtr, value);
  109. }
  110. get {
  111. ushort ret = RakNetPINVOKE.OnFileStruct_setID_get(swigCPtr);
  112. return ret;
  113. }
  114. }
  115. public uint numberOfFilesInThisSet {
  116. set {
  117. RakNetPINVOKE.OnFileStruct_numberOfFilesInThisSet_set(swigCPtr, value);
  118. }
  119. get {
  120. uint ret = RakNetPINVOKE.OnFileStruct_numberOfFilesInThisSet_get(swigCPtr);
  121. return ret;
  122. }
  123. }
  124. public uint byteLengthOfThisSet {
  125. set {
  126. RakNetPINVOKE.OnFileStruct_byteLengthOfThisSet_set(swigCPtr, value);
  127. }
  128. get {
  129. uint ret = RakNetPINVOKE.OnFileStruct_byteLengthOfThisSet_get(swigCPtr);
  130. return ret;
  131. }
  132. }
  133. public uint bytesDownloadedForThisSet {
  134. set {
  135. RakNetPINVOKE.OnFileStruct_bytesDownloadedForThisSet_set(swigCPtr, value);
  136. }
  137. get {
  138. uint ret = RakNetPINVOKE.OnFileStruct_bytesDownloadedForThisSet_get(swigCPtr);
  139. return ret;
  140. }
  141. }
  142. public FileListNodeContext context {
  143. set {
  144. RakNetPINVOKE.OnFileStruct_context_set(swigCPtr, FileListNodeContext.getCPtr(value));
  145. }
  146. get {
  147. IntPtr cPtr = RakNetPINVOKE.OnFileStruct_context_get(swigCPtr);
  148. FileListNodeContext ret = (cPtr == IntPtr.Zero) ? null : new FileListNodeContext(cPtr, false);
  149. return ret;
  150. }
  151. }
  152. public SystemAddress senderSystemAddress {
  153. set {
  154. RakNetPINVOKE.OnFileStruct_senderSystemAddress_set(swigCPtr, SystemAddress.getCPtr(value));
  155. }
  156. get {
  157. IntPtr cPtr = RakNetPINVOKE.OnFileStruct_senderSystemAddress_get(swigCPtr);
  158. SystemAddress ret = (cPtr == IntPtr.Zero) ? null : new SystemAddress(cPtr, false);
  159. return ret;
  160. }
  161. }
  162. public RakNetGUID senderGuid {
  163. set {
  164. RakNetPINVOKE.OnFileStruct_senderGuid_set(swigCPtr, RakNetGUID.getCPtr(value));
  165. }
  166. get {
  167. IntPtr cPtr = RakNetPINVOKE.OnFileStruct_senderGuid_get(swigCPtr);
  168. RakNetGUID ret = (cPtr == IntPtr.Zero) ? null : new RakNetGUID(cPtr, false);
  169. return ret;
  170. }
  171. }
  172. public OnFileStruct() : this(RakNetPINVOKE.new_OnFileStruct(), true) {
  173. }
  174. private void SetFileData(byte[] inByteArray, int numBytes) {
  175. RakNetPINVOKE.OnFileStruct_SetFileData(swigCPtr, inByteArray, numBytes);
  176. }
  177. }
  178. }
粤ICP备19079148号