Event.cs 692 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. using System;
  2. using System.Runtime.InteropServices;
  3. namespace ENet
  4. {
  5. public struct Event
  6. {
  7. private readonly IntPtr e;
  8. public Event(IntPtr e)
  9. {
  10. this.e = e;
  11. }
  12. public ENetEvent Struct
  13. {
  14. get
  15. {
  16. return (ENetEvent)Marshal.PtrToStructure(this.e, typeof(ENetEvent));
  17. }
  18. set
  19. {
  20. Marshal.StructureToPtr(value, this.e, false);
  21. }
  22. }
  23. public IntPtr NativePtr
  24. {
  25. get
  26. {
  27. return e;
  28. }
  29. }
  30. public Packet Packet
  31. {
  32. get
  33. {
  34. return new Packet(this.Struct.packet);
  35. }
  36. }
  37. public Peer Peer
  38. {
  39. get
  40. {
  41. return new Peer(this.Struct.peer);
  42. }
  43. }
  44. public EventType Type
  45. {
  46. get
  47. {
  48. return this.Struct.type;
  49. }
  50. }
  51. }
  52. }