CefProcessMessage.cs 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. namespace Xilium.CefGlue
  2. {
  3. using System;
  4. using System.Collections.Generic;
  5. using System.Diagnostics;
  6. using System.Runtime.InteropServices;
  7. using Xilium.CefGlue.Interop;
  8. /// <summary>
  9. /// Class representing a message. Can be used on any process and thread.
  10. /// </summary>
  11. public sealed unsafe partial class CefProcessMessage
  12. {
  13. /// <summary>
  14. /// Create a new CefProcessMessage object with the specified name.
  15. /// </summary>
  16. public static CefProcessMessage Create(string name)
  17. {
  18. fixed (char* name_str = name)
  19. {
  20. var n_name = new cef_string_t(name_str, name != null ? name.Length : 0);
  21. return CefProcessMessage.FromNative(
  22. cef_process_message_t.create(&n_name)
  23. );
  24. }
  25. }
  26. /// <summary>
  27. /// Returns true if this object is valid. Do not call any other methods if this
  28. /// function returns false.
  29. /// </summary>
  30. public bool IsValid
  31. {
  32. get { return cef_process_message_t.is_valid(_self) != 0; }
  33. }
  34. /// <summary>
  35. /// Returns true if the values of this object are read-only. Some APIs may
  36. /// expose read-only objects.
  37. /// </summary>
  38. public bool IsReadOnly
  39. {
  40. get { return cef_process_message_t.is_read_only(_self) != 0; }
  41. }
  42. /// <summary>
  43. /// Returns a writable copy of this object.
  44. /// </summary>
  45. public CefProcessMessage Copy()
  46. {
  47. return CefProcessMessage.FromNative(
  48. cef_process_message_t.copy(_self)
  49. );
  50. }
  51. /// <summary>
  52. /// Returns the message name.
  53. /// </summary>
  54. public string Name
  55. {
  56. get
  57. {
  58. var n_result = cef_process_message_t.get_name(_self);
  59. return cef_string_userfree.ToString(n_result);
  60. // FIXME: caching ?
  61. }
  62. }
  63. /// <summary>
  64. /// Returns the list of arguments.
  65. /// </summary>
  66. public CefListValue Arguments
  67. {
  68. get
  69. {
  70. return CefListValue.FromNative(
  71. cef_process_message_t.get_argument_list(_self)
  72. );
  73. // FIXME: caching ?
  74. }
  75. }
  76. }
  77. }