NatPunchthroughClient.cs 3.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  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 NatPunchthroughClient : PluginInterface2 {
  12. private HandleRef swigCPtr;
  13. internal NatPunchthroughClient(IntPtr cPtr, bool cMemoryOwn) : base(RakNetPINVOKE.NatPunchthroughClient_SWIGUpcast(cPtr), cMemoryOwn) {
  14. swigCPtr = new HandleRef(this, cPtr);
  15. }
  16. internal static HandleRef getCPtr(NatPunchthroughClient obj) {
  17. return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
  18. }
  19. ~NatPunchthroughClient() {
  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_NatPunchthroughClient(swigCPtr);
  28. }
  29. swigCPtr = new HandleRef(null, IntPtr.Zero);
  30. }
  31. GC.SuppressFinalize(this);
  32. base.Dispose();
  33. }
  34. }
  35. public static NatPunchthroughClient GetInstance() {
  36. IntPtr cPtr = RakNetPINVOKE.NatPunchthroughClient_GetInstance();
  37. NatPunchthroughClient ret = (cPtr == IntPtr.Zero) ? null : new NatPunchthroughClient(cPtr, false);
  38. return ret;
  39. }
  40. public static void DestroyInstance(NatPunchthroughClient i) {
  41. RakNetPINVOKE.NatPunchthroughClient_DestroyInstance(NatPunchthroughClient.getCPtr(i));
  42. }
  43. public NatPunchthroughClient() : this(RakNetPINVOKE.new_NatPunchthroughClient(), true) {
  44. }
  45. public bool OpenNAT(RakNetGUID destination, SystemAddress facilitator) {
  46. bool ret = RakNetPINVOKE.NatPunchthroughClient_OpenNAT(swigCPtr, RakNetGUID.getCPtr(destination), SystemAddress.getCPtr(facilitator));
  47. if (RakNetPINVOKE.SWIGPendingException.Pending) throw RakNetPINVOKE.SWIGPendingException.Retrieve();
  48. return ret;
  49. }
  50. public bool OpenNATGroup(RakNetListRakNetGUID destinationSystems, SystemAddress facilitator) {
  51. bool ret = RakNetPINVOKE.NatPunchthroughClient_OpenNATGroup(swigCPtr, RakNetListRakNetGUID.getCPtr(destinationSystems), SystemAddress.getCPtr(facilitator));
  52. if (RakNetPINVOKE.SWIGPendingException.Pending) throw RakNetPINVOKE.SWIGPendingException.Retrieve();
  53. return ret;
  54. }
  55. public PunchthroughConfiguration GetPunchthroughConfiguration() {
  56. IntPtr cPtr = RakNetPINVOKE.NatPunchthroughClient_GetPunchthroughConfiguration(swigCPtr);
  57. PunchthroughConfiguration ret = (cPtr == IntPtr.Zero) ? null : new PunchthroughConfiguration(cPtr, false);
  58. return ret;
  59. }
  60. public void SetDebugInterface(NatPunchthroughDebugInterface i) {
  61. RakNetPINVOKE.NatPunchthroughClient_SetDebugInterface(swigCPtr, NatPunchthroughDebugInterface.getCPtr(i));
  62. }
  63. public void GetUPNPPortMappings(string externalPort, string internalPort, SystemAddress natPunchthroughServerAddress) {
  64. RakNetPINVOKE.NatPunchthroughClient_GetUPNPPortMappings(swigCPtr, externalPort, internalPort, SystemAddress.getCPtr(natPunchthroughServerAddress));
  65. if (RakNetPINVOKE.SWIGPendingException.Pending) throw RakNetPINVOKE.SWIGPendingException.Retrieve();
  66. }
  67. public void Clear() {
  68. RakNetPINVOKE.NatPunchthroughClient_Clear(swigCPtr);
  69. }
  70. }
  71. }
粤ICP备19079148号