ICommand.cs 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using SuperSocket.SocketBase.Protocol;
  6. namespace SuperSocket.SocketBase.Command
  7. {
  8. /// <summary>
  9. /// Command basic interface
  10. /// </summary>
  11. public interface ICommand
  12. {
  13. /// <summary>
  14. /// Gets the name.
  15. /// </summary>
  16. string Name { get; }
  17. }
  18. /// <summary>
  19. /// Command basic interface
  20. /// </summary>
  21. /// <typeparam name="TAppSession">The type of the app session.</typeparam>
  22. /// <typeparam name="TRequestInfo">The type of the request info.</typeparam>
  23. public interface ICommand<TAppSession, TRequestInfo> : ICommand
  24. where TRequestInfo : IRequestInfo
  25. where TAppSession : IAppSession
  26. {
  27. /// <summary>
  28. /// Executes the command.
  29. /// </summary>
  30. /// <param name="session">The session.</param>
  31. /// <param name="requestInfo">The request info.</param>
  32. void ExecuteCommand(TAppSession session, TRequestInfo requestInfo);
  33. }
  34. /// <summary>
  35. /// Mockup command
  36. /// </summary>
  37. /// <typeparam name="TAppSession">The type of the app session.</typeparam>
  38. /// <typeparam name="TRequestInfo">The type of the request info.</typeparam>
  39. public class MockupCommand<TAppSession, TRequestInfo> : ICommand<TAppSession, TRequestInfo>
  40. where TRequestInfo : IRequestInfo
  41. where TAppSession : IAppSession
  42. {
  43. /// <summary>
  44. /// Initializes a new instance of the <see cref="MockupCommand&lt;TAppSession, TRequestInfo&gt;"/> class.
  45. /// </summary>
  46. /// <param name="name">The name.</param>
  47. public MockupCommand(string name)
  48. {
  49. Name = name;
  50. }
  51. /// <summary>
  52. /// Executes the command.
  53. /// </summary>
  54. /// <param name="session">The session.</param>
  55. /// <param name="requestInfo">The request info.</param>
  56. public void ExecuteCommand(TAppSession session, TRequestInfo requestInfo)
  57. {
  58. }
  59. /// <summary>
  60. /// Gets the name.
  61. /// </summary>
  62. public string Name { get; private set; }
  63. }
  64. }