TransportInterface.cs 3.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  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 TransportInterface : IDisposable {
  12. private HandleRef swigCPtr;
  13. protected bool swigCMemOwn;
  14. internal TransportInterface(IntPtr cPtr, bool cMemoryOwn) {
  15. swigCMemOwn = cMemoryOwn;
  16. swigCPtr = new HandleRef(this, cPtr);
  17. }
  18. internal static HandleRef getCPtr(TransportInterface obj) {
  19. return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
  20. }
  21. ~TransportInterface() {
  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_TransportInterface(swigCPtr);
  30. }
  31. swigCPtr = new HandleRef(null, IntPtr.Zero);
  32. }
  33. GC.SuppressFinalize(this);
  34. }
  35. }
  36. public virtual bool Start(ushort port, bool serverMode) {
  37. bool ret = RakNetPINVOKE.TransportInterface_Start(swigCPtr, port, serverMode);
  38. return ret;
  39. }
  40. public virtual void Stop() {
  41. RakNetPINVOKE.TransportInterface_Stop(swigCPtr);
  42. }
  43. public virtual void CloseConnection(SystemAddress systemAddress) {
  44. RakNetPINVOKE.TransportInterface_CloseConnection(swigCPtr, SystemAddress.getCPtr(systemAddress));
  45. if (RakNetPINVOKE.SWIGPendingException.Pending) throw RakNetPINVOKE.SWIGPendingException.Retrieve();
  46. }
  47. public virtual Packet Receive() {
  48. IntPtr cPtr = RakNetPINVOKE.TransportInterface_Receive(swigCPtr);
  49. Packet ret = (cPtr == IntPtr.Zero) ? null : new Packet(cPtr, false);
  50. return ret;
  51. }
  52. public virtual void DeallocatePacket(Packet packet) {
  53. RakNetPINVOKE.TransportInterface_DeallocatePacket(swigCPtr, Packet.getCPtr(packet));
  54. }
  55. public virtual SystemAddress HasNewIncomingConnection() {
  56. SystemAddress ret = new SystemAddress(RakNetPINVOKE.TransportInterface_HasNewIncomingConnection(swigCPtr), true);
  57. return ret;
  58. }
  59. public virtual SystemAddress HasLostConnection() {
  60. SystemAddress ret = new SystemAddress(RakNetPINVOKE.TransportInterface_HasLostConnection(swigCPtr), true);
  61. return ret;
  62. }
  63. public virtual CommandParserInterface GetCommandParser() {
  64. IntPtr cPtr = RakNetPINVOKE.TransportInterface_GetCommandParser(swigCPtr);
  65. CommandParserInterface ret = (cPtr == IntPtr.Zero) ? null : new CommandParserInterface(cPtr, false);
  66. return ret;
  67. }
  68. public void Send(SystemAddress systemAddress, byte[] inByteArray) {
  69. RakNetPINVOKE.TransportInterface_Send(swigCPtr, SystemAddress.getCPtr(systemAddress), inByteArray);
  70. if (RakNetPINVOKE.SWIGPendingException.Pending) throw RakNetPINVOKE.SWIGPendingException.Retrieve();
  71. }
  72. }
  73. }
粤ICP备19079148号