FileListNode.cs 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154
  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 FileListNode : IDisposable {
  12. private HandleRef swigCPtr;
  13. protected bool swigCMemOwn;
  14. internal FileListNode(IntPtr cPtr, bool cMemoryOwn) {
  15. swigCMemOwn = cMemoryOwn;
  16. swigCPtr = new HandleRef(this, cPtr);
  17. }
  18. internal static HandleRef getCPtr(FileListNode obj) {
  19. return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
  20. }
  21. ~FileListNode() {
  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_FileListNode(swigCPtr);
  30. }
  31. swigCPtr = new HandleRef(null, IntPtr.Zero);
  32. }
  33. GC.SuppressFinalize(this);
  34. }
  35. }
  36. private bool dataIsCached = false;
  37. private byte[] dataCache;
  38. public RakString filename {
  39. set {
  40. RakNetPINVOKE.FileListNode_filename_set(swigCPtr, RakString.getCPtr(value));
  41. }
  42. get {
  43. IntPtr cPtr = RakNetPINVOKE.FileListNode_filename_get(swigCPtr);
  44. RakString ret = (cPtr == IntPtr.Zero) ? null : new RakString(cPtr, false);
  45. return ret;
  46. }
  47. }
  48. public RakString fullPathToFile {
  49. set {
  50. RakNetPINVOKE.FileListNode_fullPathToFile_set(swigCPtr, RakString.getCPtr(value));
  51. }
  52. get {
  53. IntPtr cPtr = RakNetPINVOKE.FileListNode_fullPathToFile_get(swigCPtr);
  54. RakString ret = (cPtr == IntPtr.Zero) ? null : new RakString(cPtr, false);
  55. return ret;
  56. }
  57. }
  58. public byte[] data {
  59. set
  60. {
  61. dataCache=value;
  62. dataIsCached = true;
  63. SetData (value, value.Length);
  64. }
  65. get
  66. {
  67. byte[] returnArray;
  68. if (!dataIsCached)
  69. {
  70. IntPtr cPtr = RakNetPINVOKE.FileListNode_data_get (swigCPtr);
  71. int len = (int) dataLengthBytes;
  72. if (len<=0)
  73. {
  74. return null;
  75. }
  76. returnArray = new byte[len];
  77. byte[] marshalArray = new byte[len];
  78. Marshal.Copy(cPtr, marshalArray, 0, len);
  79. marshalArray.CopyTo(returnArray, 0);
  80. dataCache = returnArray;
  81. dataIsCached = true;
  82. }
  83. else
  84. {
  85. returnArray = dataCache;
  86. }
  87. return returnArray;
  88. }
  89. }
  90. public uint dataLengthBytes {
  91. set {
  92. RakNetPINVOKE.FileListNode_dataLengthBytes_set(swigCPtr, value);
  93. }
  94. get {
  95. uint ret = RakNetPINVOKE.FileListNode_dataLengthBytes_get(swigCPtr);
  96. return ret;
  97. }
  98. }
  99. public uint fileLengthBytes {
  100. set {
  101. RakNetPINVOKE.FileListNode_fileLengthBytes_set(swigCPtr, value);
  102. }
  103. get {
  104. uint ret = RakNetPINVOKE.FileListNode_fileLengthBytes_get(swigCPtr);
  105. return ret;
  106. }
  107. }
  108. public FileListNodeContext context {
  109. set {
  110. RakNetPINVOKE.FileListNode_context_set(swigCPtr, FileListNodeContext.getCPtr(value));
  111. }
  112. get {
  113. IntPtr cPtr = RakNetPINVOKE.FileListNode_context_get(swigCPtr);
  114. FileListNodeContext ret = (cPtr == IntPtr.Zero) ? null : new FileListNodeContext(cPtr, false);
  115. return ret;
  116. }
  117. }
  118. public bool isAReference {
  119. set {
  120. RakNetPINVOKE.FileListNode_isAReference_set(swigCPtr, value);
  121. }
  122. get {
  123. bool ret = RakNetPINVOKE.FileListNode_isAReference_get(swigCPtr);
  124. return ret;
  125. }
  126. }
  127. public FileListNode() : this(RakNetPINVOKE.new_FileListNode(), true) {
  128. }
  129. public void SetData(byte[] inByteArray, int numBytes) {
  130. RakNetPINVOKE.FileListNode_SetData(swigCPtr, inByteArray, numBytes);
  131. }
  132. }
  133. }
粤ICP备19079148号