Connection.cs 986 B

12345678910111213141516171819202122232425262728293031323334
  1. using System;
  2. using System.Runtime.InteropServices;
  3. namespace Urho.Network {
  4. public partial class Connection {
  5. public void SendMessage (int msgId, bool reliable, bool inOrder, byte [] buffer, uint contentId = 0)
  6. {
  7. Runtime.ValidateRefCounted(this);
  8. unsafe {
  9. fixed (byte *p = &buffer[0])
  10. Connection_SendMessage (handle, msgId, reliable, inOrder, p, (uint) buffer.Length, contentId);
  11. }
  12. }
  13. [DllImport (Consts.NativeImport, CallingConvention=CallingConvention.Cdecl)]
  14. extern static IntPtr Connection_GetControls (IntPtr handle);
  15. [DllImport (Consts.NativeImport, CallingConvention=CallingConvention.Cdecl)]
  16. extern static IntPtr Connection_SetControls (IntPtr handle, IntPtr controlHandle);
  17. public Controls Controls {
  18. get
  19. {
  20. Runtime.ValidateRefCounted(this);
  21. return new Controls (this, Connection_GetControls (handle));
  22. }
  23. set
  24. {
  25. Runtime.ValidateRefCounted(this);
  26. Connection_SetControls (handle, value.handle);
  27. }
  28. }
  29. }
  30. }