IDebugCommandHost.cs 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118
  1. //-----------------------------------------------------------------------------
  2. // IDebugCommandHost.cs
  3. //
  4. // Microsoft XNA Community Game Platform
  5. // Copyright (C) Microsoft Corporation. All rights reserved.
  6. //-----------------------------------------------------------------------------
  7. using System.Collections.Generic;
  8. namespace PerformanceMeasuring.GameDebugTools
  9. {
  10. /// <summary>
  11. /// Message types for debug command.
  12. /// </summary>
  13. public enum DebugCommandMessage
  14. {
  15. Standard = 1,
  16. Error = 2,
  17. Warning = 3
  18. }
  19. /// <summary>
  20. /// Debug command execution delegate.
  21. /// </summary>
  22. /// <param name="host">Host who will execute the command.</param>
  23. /// <param name="command">command name</param>
  24. /// <param name="arguments">command arguments</param>
  25. public delegate void DebugCommandExecute(IDebugCommandHost host, string command,
  26. IList<string> arguments);
  27. /// <summary>
  28. /// Interface for debug command executioner.
  29. /// </summary>
  30. public interface IDebugCommandExecutioner
  31. {
  32. /// <summary>
  33. /// Execute command
  34. /// </summary>
  35. void ExecuteCommand(string command);
  36. }
  37. /// <summary>
  38. /// Interface for debug command message listener.
  39. /// </summary>
  40. public interface IDebugEchoListner
  41. {
  42. /// <summary>
  43. /// Output message.
  44. /// </summary>
  45. /// <param name="messageType">type of message</param>
  46. /// <param name="text">message text</param>
  47. void Echo(DebugCommandMessage messageType, string text);
  48. }
  49. /// <summary>
  50. /// Interface for debug command host.
  51. /// </summary>
  52. public interface IDebugCommandHost : IDebugEchoListner, IDebugCommandExecutioner
  53. {
  54. /// <summary>
  55. /// Register new command.
  56. /// </summary>
  57. /// <param name="command">command name</param>
  58. /// <param name="description">description of command</param>
  59. /// <param name="callback">Execute delegation</param>
  60. void RegisterCommand(string command, string description,
  61. DebugCommandExecute callback);
  62. /// <summary>
  63. /// Unregister command.
  64. /// </summary>
  65. /// <param name="command">command name</param>
  66. void UnregisterCommand(string command);
  67. /// <summary>
  68. /// Output Standard message.
  69. /// </summary>
  70. /// <param name="text"></param>
  71. void Echo(string text);
  72. /// <summary>
  73. /// Output Warning message.
  74. /// </summary>
  75. /// <param name="text"></param>
  76. void EchoWarning(string text);
  77. /// <summary>
  78. /// Output Error message.
  79. /// </summary>
  80. /// <param name="text"></param>
  81. void EchoError(string text);
  82. /// <summary>
  83. /// Register message listener.
  84. /// </summary>
  85. /// <param name="listner"></param>
  86. void RegisterEchoListner(IDebugEchoListner listner);
  87. /// <summary>
  88. /// Unregister message listener.
  89. /// </summary>
  90. /// <param name="listner"></param>
  91. void UnregisterEchoListner(IDebugEchoListner listner);
  92. /// <summary>
  93. /// Add Command executioner.
  94. /// </summary>
  95. void PushExecutioner(IDebugCommandExecutioner executioner);
  96. /// <summary>
  97. /// Remote Command executioner.
  98. /// </summary>
  99. void PopExecutioner();
  100. }
  101. }