SystemAddress.cs 8.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287
  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 SystemAddress : IDisposable {
  13. private HandleRef swigCPtr;
  14. protected bool swigCMemOwn;
  15. internal SystemAddress(IntPtr cPtr, bool cMemoryOwn) {
  16. swigCMemOwn = cMemoryOwn;
  17. swigCPtr = new HandleRef(this, cPtr);
  18. }
  19. internal static HandleRef getCPtr(SystemAddress obj) {
  20. return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
  21. }
  22. ~SystemAddress() {
  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_SystemAddress(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.port+this.binaryAddress)% int.MaxValue);
  40. return (int) ToInteger(this);
  41. }
  42. public static bool operator ==(SystemAddress a, SystemAddress 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 !=(SystemAddress a, SystemAddress b)
  57. {
  58. return a.OpNotEqual(b);
  59. }
  60. public static bool operator < (SystemAddress a, SystemAddress b)
  61. {
  62. return a.OpLess(b);
  63. }
  64. public static bool operator >(SystemAddress a, SystemAddress b)
  65. {
  66. return a.OpGreater(b);
  67. }
  68. public static bool operator <=(SystemAddress a, SystemAddress b)
  69. {
  70. return (a.OpLess(b) || a==b);
  71. }
  72. public static bool operator >=(SystemAddress a, SystemAddress b)
  73. {
  74. return (a.OpGreater(b) || a==b);
  75. }
  76. public override string ToString()
  77. {
  78. return ToString(true);
  79. }
  80. public void ToString(bool writePort,out string dest)
  81. {
  82. dest=ToString(writePort);
  83. }
  84. public SystemAddress() : this(RakNetPINVOKE.new_SystemAddress__SWIG_0(), true) {
  85. }
  86. public SystemAddress(string str) : this(RakNetPINVOKE.new_SystemAddress__SWIG_1(str), true) {
  87. }
  88. public SystemAddress(string str, ushort port) : this(RakNetPINVOKE.new_SystemAddress__SWIG_2(str, port), true) {
  89. }
  90. public ushort debugPort {
  91. set {
  92. RakNetPINVOKE.SystemAddress_debugPort_set(swigCPtr, value);
  93. }
  94. get {
  95. ushort ret = RakNetPINVOKE.SystemAddress_debugPort_get(swigCPtr);
  96. return ret;
  97. }
  98. }
  99. public static int size() {
  100. int ret = RakNetPINVOKE.SystemAddress_size();
  101. return ret;
  102. }
  103. public static uint ToInteger(SystemAddress sa) {
  104. uint ret = RakNetPINVOKE.SystemAddress_ToInteger(SystemAddress.getCPtr(sa));
  105. if (RakNetPINVOKE.SWIGPendingException.Pending) throw RakNetPINVOKE.SWIGPendingException.Retrieve();
  106. return ret;
  107. }
  108. public byte GetIPVersion() {
  109. byte ret = RakNetPINVOKE.SystemAddress_GetIPVersion(swigCPtr);
  110. return ret;
  111. }
  112. public uint GetIPPROTO() {
  113. uint ret = RakNetPINVOKE.SystemAddress_GetIPPROTO(swigCPtr);
  114. return ret;
  115. }
  116. public void SetToLoopback() {
  117. RakNetPINVOKE.SystemAddress_SetToLoopback__SWIG_0(swigCPtr);
  118. }
  119. public void SetToLoopback(byte ipVersion) {
  120. RakNetPINVOKE.SystemAddress_SetToLoopback__SWIG_1(swigCPtr, ipVersion);
  121. }
  122. public bool IsLoopback() {
  123. bool ret = RakNetPINVOKE.SystemAddress_IsLoopback(swigCPtr);
  124. return ret;
  125. }
  126. public string ToString(bool writePort, char portDelineator) {
  127. string ret = RakNetPINVOKE.SystemAddress_ToString__SWIG_0(swigCPtr, writePort, portDelineator);
  128. return ret;
  129. }
  130. public string ToString(bool writePort) {
  131. string ret = RakNetPINVOKE.SystemAddress_ToString__SWIG_1(swigCPtr, writePort);
  132. return ret;
  133. }
  134. public void ToString(bool writePort, string dest, char portDelineator) {
  135. RakNetPINVOKE.SystemAddress_ToString__SWIG_2(swigCPtr, writePort, dest, portDelineator);
  136. }
  137. public bool FromString(string str, char portDelineator, int ipVersion) {
  138. bool ret = RakNetPINVOKE.SystemAddress_FromString__SWIG_0(swigCPtr, str, portDelineator, ipVersion);
  139. return ret;
  140. }
  141. public bool FromString(string str, char portDelineator) {
  142. bool ret = RakNetPINVOKE.SystemAddress_FromString__SWIG_1(swigCPtr, str, portDelineator);
  143. return ret;
  144. }
  145. public bool FromString(string str) {
  146. bool ret = RakNetPINVOKE.SystemAddress_FromString__SWIG_2(swigCPtr, str);
  147. return ret;
  148. }
  149. public bool FromStringExplicitPort(string str, ushort port, int ipVersion) {
  150. bool ret = RakNetPINVOKE.SystemAddress_FromStringExplicitPort__SWIG_0(swigCPtr, str, port, ipVersion);
  151. return ret;
  152. }
  153. public bool FromStringExplicitPort(string str, ushort port) {
  154. bool ret = RakNetPINVOKE.SystemAddress_FromStringExplicitPort__SWIG_1(swigCPtr, str, port);
  155. return ret;
  156. }
  157. public void CopyPort(SystemAddress right) {
  158. RakNetPINVOKE.SystemAddress_CopyPort(swigCPtr, SystemAddress.getCPtr(right));
  159. if (RakNetPINVOKE.SWIGPendingException.Pending) throw RakNetPINVOKE.SWIGPendingException.Retrieve();
  160. }
  161. public bool EqualsExcludingPort(SystemAddress right) {
  162. bool ret = RakNetPINVOKE.SystemAddress_EqualsExcludingPort(swigCPtr, SystemAddress.getCPtr(right));
  163. if (RakNetPINVOKE.SWIGPendingException.Pending) throw RakNetPINVOKE.SWIGPendingException.Retrieve();
  164. return ret;
  165. }
  166. public ushort GetPort() {
  167. ushort ret = RakNetPINVOKE.SystemAddress_GetPort(swigCPtr);
  168. return ret;
  169. }
  170. public ushort GetPortNetworkOrder() {
  171. ushort ret = RakNetPINVOKE.SystemAddress_GetPortNetworkOrder(swigCPtr);
  172. return ret;
  173. }
  174. public void SetPort(ushort s) {
  175. RakNetPINVOKE.SystemAddress_SetPort(swigCPtr, s);
  176. }
  177. public void SetPortNetworkOrder(ushort s) {
  178. RakNetPINVOKE.SystemAddress_SetPortNetworkOrder(swigCPtr, s);
  179. }
  180. public void SetBinaryAddress(string str, char portDelineator) {
  181. RakNetPINVOKE.SystemAddress_SetBinaryAddress__SWIG_0(swigCPtr, str, portDelineator);
  182. }
  183. public void SetBinaryAddress(string str) {
  184. RakNetPINVOKE.SystemAddress_SetBinaryAddress__SWIG_1(swigCPtr, str);
  185. }
  186. public void ToString_Old(bool writePort, string dest, char portDelineator) {
  187. RakNetPINVOKE.SystemAddress_ToString_Old__SWIG_0(swigCPtr, writePort, dest, portDelineator);
  188. }
  189. public void ToString_Old(bool writePort, string dest) {
  190. RakNetPINVOKE.SystemAddress_ToString_Old__SWIG_1(swigCPtr, writePort, dest);
  191. }
  192. public void FixForIPVersion(SystemAddress boundAddressToSocket) {
  193. RakNetPINVOKE.SystemAddress_FixForIPVersion(swigCPtr, SystemAddress.getCPtr(boundAddressToSocket));
  194. if (RakNetPINVOKE.SWIGPendingException.Pending) throw RakNetPINVOKE.SWIGPendingException.Retrieve();
  195. }
  196. public SystemAddress CopyData(SystemAddress input) {
  197. SystemAddress ret = new SystemAddress(RakNetPINVOKE.SystemAddress_CopyData(swigCPtr, SystemAddress.getCPtr(input)), false);
  198. if (RakNetPINVOKE.SWIGPendingException.Pending) throw RakNetPINVOKE.SWIGPendingException.Retrieve();
  199. return ret;
  200. }
  201. public bool Equals(SystemAddress right) {
  202. bool ret = RakNetPINVOKE.SystemAddress_Equals(swigCPtr, SystemAddress.getCPtr(right));
  203. if (RakNetPINVOKE.SWIGPendingException.Pending) throw RakNetPINVOKE.SWIGPendingException.Retrieve();
  204. return ret;
  205. }
  206. private bool OpNotEqual(SystemAddress right) {
  207. bool ret = RakNetPINVOKE.SystemAddress_OpNotEqual(swigCPtr, SystemAddress.getCPtr(right));
  208. if (RakNetPINVOKE.SWIGPendingException.Pending) throw RakNetPINVOKE.SWIGPendingException.Retrieve();
  209. return ret;
  210. }
  211. private bool OpGreater(SystemAddress right) {
  212. bool ret = RakNetPINVOKE.SystemAddress_OpGreater(swigCPtr, SystemAddress.getCPtr(right));
  213. if (RakNetPINVOKE.SWIGPendingException.Pending) throw RakNetPINVOKE.SWIGPendingException.Retrieve();
  214. return ret;
  215. }
  216. private bool OpLess(SystemAddress right) {
  217. bool ret = RakNetPINVOKE.SystemAddress_OpLess(swigCPtr, SystemAddress.getCPtr(right));
  218. if (RakNetPINVOKE.SWIGPendingException.Pending) throw RakNetPINVOKE.SWIGPendingException.Retrieve();
  219. return ret;
  220. }
  221. public ushort systemIndex {
  222. set {
  223. RakNetPINVOKE.SystemAddress_systemIndex_set(swigCPtr, value);
  224. }
  225. get {
  226. ushort ret = RakNetPINVOKE.SystemAddress_systemIndex_get(swigCPtr);
  227. return ret;
  228. }
  229. }
  230. }
  231. }
粤ICP备19079148号