ConnectionGraph2.cs 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141
  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 ConnectionGraph2 : PluginInterface2 {
  12. private HandleRef swigCPtr;
  13. internal ConnectionGraph2(IntPtr cPtr, bool cMemoryOwn) : base(RakNetPINVOKE.ConnectionGraph2_SWIGUpcast(cPtr), cMemoryOwn) {
  14. swigCPtr = new HandleRef(this, cPtr);
  15. }
  16. internal static HandleRef getCPtr(ConnectionGraph2 obj) {
  17. return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
  18. }
  19. ~ConnectionGraph2() {
  20. Dispose();
  21. }
  22. public override void Dispose() {
  23. lock(this) {
  24. if (swigCPtr.Handle != IntPtr.Zero) {
  25. if (swigCMemOwn) {
  26. swigCMemOwn = false;
  27. RakNetPINVOKE.delete_ConnectionGraph2(swigCPtr);
  28. }
  29. swigCPtr = new HandleRef(null, IntPtr.Zero);
  30. }
  31. GC.SuppressFinalize(this);
  32. base.Dispose();
  33. }
  34. }
  35. public bool GetConnectionListForRemoteSystem(RakNetGUID remoteSystemGuid, SystemAddress[] saOut, RakNetGUID[] guidOut, ref uint inOutLength)
  36. {
  37. uint minLength = inOutLength;
  38. if (guidOut.Length < minLength)
  39. { minLength = (uint)guidOut.Length; }
  40. if (saOut.Length < minLength)
  41. { minLength = (uint)saOut.Length; }
  42. RakNetListRakNetGUID passListGUID = new RakNetListRakNetGUID();
  43. RakNetListSystemAddress passListSystemAddress = new RakNetListSystemAddress();
  44. bool returnVal = GetConnectionListForRemoteSystemHelper(remoteSystemGuid, passListSystemAddress, passListGUID, ref inOutLength);
  45. if (inOutLength< minLength)
  46. { minLength = (uint)inOutLength;}
  47. for (int i = 0; i < minLength; i++)
  48. {
  49. guidOut[i] = passListGUID[i];
  50. saOut[i] = passListSystemAddress[i];
  51. }
  52. return returnVal;
  53. }
  54. public void GetParticipantList(RakNetGUID[] participantList)
  55. {
  56. RakNetListRakNetGUID passListGUID = new RakNetListRakNetGUID();
  57. GetParticipantListHelper(passListGUID);
  58. for (int i = 0; i < participantList.Length && i < passListGUID.Size(); i++)
  59. {
  60. participantList[i] = passListGUID[i];
  61. }
  62. }
  63. public static ConnectionGraph2 GetInstance() {
  64. IntPtr cPtr = RakNetPINVOKE.ConnectionGraph2_GetInstance();
  65. ConnectionGraph2 ret = (cPtr == IntPtr.Zero) ? null : new ConnectionGraph2(cPtr, false);
  66. return ret;
  67. }
  68. public static void DestroyInstance(ConnectionGraph2 i) {
  69. RakNetPINVOKE.ConnectionGraph2_DestroyInstance(ConnectionGraph2.getCPtr(i));
  70. }
  71. public ConnectionGraph2() : this(RakNetPINVOKE.new_ConnectionGraph2(), true) {
  72. }
  73. public bool GetConnectionListForRemoteSystem(RakNetGUID remoteSystemGuid, SystemAddress saOut, RakNetGUID guidOut, out uint outLength) {
  74. bool ret = RakNetPINVOKE.ConnectionGraph2_GetConnectionListForRemoteSystem(swigCPtr, RakNetGUID.getCPtr(remoteSystemGuid), SystemAddress.getCPtr(saOut), RakNetGUID.getCPtr(guidOut), out outLength);
  75. if (RakNetPINVOKE.SWIGPendingException.Pending) throw RakNetPINVOKE.SWIGPendingException.Retrieve();
  76. return ret;
  77. }
  78. public bool ConnectionExists(RakNetGUID g1, RakNetGUID g2) {
  79. bool ret = RakNetPINVOKE.ConnectionGraph2_ConnectionExists(swigCPtr, RakNetGUID.getCPtr(g1), RakNetGUID.getCPtr(g2));
  80. if (RakNetPINVOKE.SWIGPendingException.Pending) throw RakNetPINVOKE.SWIGPendingException.Retrieve();
  81. return ret;
  82. }
  83. public ushort GetPingBetweenSystems(RakNetGUID g1, RakNetGUID g2) {
  84. ushort ret = RakNetPINVOKE.ConnectionGraph2_GetPingBetweenSystems(swigCPtr, RakNetGUID.getCPtr(g1), RakNetGUID.getCPtr(g2));
  85. if (RakNetPINVOKE.SWIGPendingException.Pending) throw RakNetPINVOKE.SWIGPendingException.Retrieve();
  86. return ret;
  87. }
  88. public RakNetGUID GetLowestAveragePingSystem() {
  89. RakNetGUID ret = new RakNetGUID(RakNetPINVOKE.ConnectionGraph2_GetLowestAveragePingSystem(swigCPtr), true);
  90. return ret;
  91. }
  92. public void SetAutoProcessNewConnections(bool b) {
  93. RakNetPINVOKE.ConnectionGraph2_SetAutoProcessNewConnections(swigCPtr, b);
  94. }
  95. public bool GetAutoProcessNewConnections() {
  96. bool ret = RakNetPINVOKE.ConnectionGraph2_GetAutoProcessNewConnections(swigCPtr);
  97. return ret;
  98. }
  99. public void AddParticipant(SystemAddress systemAddress, RakNetGUID rakNetGUID) {
  100. RakNetPINVOKE.ConnectionGraph2_AddParticipant(swigCPtr, SystemAddress.getCPtr(systemAddress), RakNetGUID.getCPtr(rakNetGUID));
  101. if (RakNetPINVOKE.SWIGPendingException.Pending) throw RakNetPINVOKE.SWIGPendingException.Retrieve();
  102. }
  103. private bool GetConnectionListForRemoteSystemHelper(RakNetGUID remoteSystemGuid, RakNetListSystemAddress saOut, RakNetListRakNetGUID guidOut, ref uint inOutLength) {
  104. bool ret = RakNetPINVOKE.ConnectionGraph2_GetConnectionListForRemoteSystemHelper(swigCPtr, RakNetGUID.getCPtr(remoteSystemGuid), RakNetListSystemAddress.getCPtr(saOut), RakNetListRakNetGUID.getCPtr(guidOut), ref inOutLength);
  105. if (RakNetPINVOKE.SWIGPendingException.Pending) throw RakNetPINVOKE.SWIGPendingException.Retrieve();
  106. return ret;
  107. }
  108. private void GetParticipantListHelper(RakNetListRakNetGUID guidOut) {
  109. RakNetPINVOKE.ConnectionGraph2_GetParticipantListHelper(swigCPtr, RakNetListRakNetGUID.getCPtr(guidOut));
  110. }
  111. }
  112. }
粤ICP备19079148号