RakNetGUID.cs 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178
  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. #pragma warning disable 0660
  12. public class RakNetGUID : IDisposable {
  13. private HandleRef swigCPtr;
  14. protected bool swigCMemOwn;
  15. internal RakNetGUID(IntPtr cPtr, bool cMemoryOwn) {
  16. swigCMemOwn = cMemoryOwn;
  17. swigCPtr = new HandleRef(this, cPtr);
  18. }
  19. internal static HandleRef getCPtr(RakNetGUID obj) {
  20. return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
  21. }
  22. ~RakNetGUID() {
  23. Dispose();
  24. }
  25. public virtual void Dispose() {
  26. lock(this) {
  27. if (swigCPtr.Handle != IntPtr.Zero) {
  28. if (swigCMemOwn) {
  29. swigCMemOwn = false;
  30. RakNetPINVOKE.delete_RakNetGUID(swigCPtr);
  31. }
  32. swigCPtr = new HandleRef(null, IntPtr.Zero);
  33. }
  34. GC.SuppressFinalize(this);
  35. }
  36. }
  37. public override int GetHashCode()
  38. {
  39. // return (int)(this.g%int.MaxValue);
  40. return (int) ToUint32(this);
  41. }
  42. public static bool operator ==(RakNetGUID a, RakNetGUID b)
  43. {
  44. // If both are null, or both are same instance, return true.
  45. if (System.Object.ReferenceEquals(a, b))
  46. {
  47. return true;
  48. }
  49. // If one is null, but not both, return false.
  50. if (((object)a == null) || ((object)b == null))
  51. {
  52. return false;
  53. }
  54. return a.Equals(b);//Equals should be overloaded as well
  55. }
  56. public static bool operator !=(RakNetGUID a, RakNetGUID b)
  57. {
  58. return a.OpNotEqual(b);
  59. }
  60. public static bool operator < (RakNetGUID a, RakNetGUID b)
  61. {
  62. return a.OpLess(b);
  63. }
  64. public static bool operator >(RakNetGUID a, RakNetGUID b)
  65. {
  66. return a.OpGreater(b);
  67. }
  68. public static bool operator <=(RakNetGUID a, RakNetGUID b)
  69. {
  70. return (a.OpLess(b) || a==b);
  71. }
  72. public static bool operator >=(RakNetGUID a, RakNetGUID b)
  73. {
  74. return (a.OpGreater(b) || a==b);
  75. }
  76. public void ToString(out string dest)
  77. {
  78. dest = ToString();
  79. }
  80. public RakNetGUID() : this(RakNetPINVOKE.new_RakNetGUID__SWIG_0(), true) {
  81. }
  82. public RakNetGUID(ulong _g) : this(RakNetPINVOKE.new_RakNetGUID__SWIG_1(_g), true) {
  83. }
  84. public ulong g {
  85. set {
  86. RakNetPINVOKE.RakNetGUID_g_set(swigCPtr, value);
  87. }
  88. get {
  89. ulong ret = RakNetPINVOKE.RakNetGUID_g_get(swigCPtr);
  90. return ret;
  91. }
  92. }
  93. public override string ToString() {
  94. string ret = RakNetPINVOKE.RakNetGUID_ToString(swigCPtr);
  95. return ret;
  96. }
  97. public bool FromString(string source) {
  98. bool ret = RakNetPINVOKE.RakNetGUID_FromString(swigCPtr, source);
  99. return ret;
  100. }
  101. public static uint ToUint32(RakNetGUID g) {
  102. uint ret = RakNetPINVOKE.RakNetGUID_ToUint32(RakNetGUID.getCPtr(g));
  103. if (RakNetPINVOKE.SWIGPendingException.Pending) throw RakNetPINVOKE.SWIGPendingException.Retrieve();
  104. return ret;
  105. }
  106. public RakNetGUID CopyData(RakNetGUID input) {
  107. RakNetGUID ret = new RakNetGUID(RakNetPINVOKE.RakNetGUID_CopyData(swigCPtr, RakNetGUID.getCPtr(input)), false);
  108. if (RakNetPINVOKE.SWIGPendingException.Pending) throw RakNetPINVOKE.SWIGPendingException.Retrieve();
  109. return ret;
  110. }
  111. public ushort systemIndex {
  112. set {
  113. RakNetPINVOKE.RakNetGUID_systemIndex_set(swigCPtr, value);
  114. }
  115. get {
  116. ushort ret = RakNetPINVOKE.RakNetGUID_systemIndex_get(swigCPtr);
  117. return ret;
  118. }
  119. }
  120. public static int size() {
  121. int ret = RakNetPINVOKE.RakNetGUID_size();
  122. return ret;
  123. }
  124. public bool Equals(RakNetGUID right) {
  125. bool ret = RakNetPINVOKE.RakNetGUID_Equals(swigCPtr, RakNetGUID.getCPtr(right));
  126. if (RakNetPINVOKE.SWIGPendingException.Pending) throw RakNetPINVOKE.SWIGPendingException.Retrieve();
  127. return ret;
  128. }
  129. private bool OpNotEqual(RakNetGUID right) {
  130. bool ret = RakNetPINVOKE.RakNetGUID_OpNotEqual(swigCPtr, RakNetGUID.getCPtr(right));
  131. if (RakNetPINVOKE.SWIGPendingException.Pending) throw RakNetPINVOKE.SWIGPendingException.Retrieve();
  132. return ret;
  133. }
  134. private bool OpGreater(RakNetGUID right) {
  135. bool ret = RakNetPINVOKE.RakNetGUID_OpGreater(swigCPtr, RakNetGUID.getCPtr(right));
  136. if (RakNetPINVOKE.SWIGPendingException.Pending) throw RakNetPINVOKE.SWIGPendingException.Retrieve();
  137. return ret;
  138. }
  139. private bool OpLess(RakNetGUID right) {
  140. bool ret = RakNetPINVOKE.RakNetGUID_OpLess(swigCPtr, RakNetGUID.getCPtr(right));
  141. if (RakNetPINVOKE.SWIGPendingException.Pending) throw RakNetPINVOKE.SWIGPendingException.Retrieve();
  142. return ret;
  143. }
  144. }
  145. }
粤ICP备19079148号