ICommandLoader.cs 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using SuperSocket.Common;
  6. using SuperSocket.SocketBase.Protocol;
  7. using SuperSocket.SocketBase.Config;
  8. namespace SuperSocket.SocketBase.Command
  9. {
  10. /// <summary>
  11. /// the empty basic interface for command loader
  12. /// </summary>
  13. public interface ICommandLoader
  14. {
  15. }
  16. /// <summary>
  17. /// Command loader's interface
  18. /// </summary>
  19. public interface ICommandLoader<TCommand> : ICommandLoader
  20. where TCommand : ICommand
  21. {
  22. /// <summary>
  23. /// Initializes the command loader by the root config and the server instance.
  24. /// </summary>
  25. /// <param name="rootConfig">The root config.</param>
  26. /// <param name="appServer">The app server.</param>
  27. /// <returns></returns>
  28. bool Initialize(IRootConfig rootConfig, IAppServer appServer);
  29. /// <summary>
  30. /// Tries to load commands.
  31. /// </summary>
  32. /// <param name="commands">The commands.</param>
  33. /// <returns></returns>
  34. bool TryLoadCommands(out IEnumerable<TCommand> commands);
  35. /// <summary>
  36. /// Occurs when [updated].
  37. /// </summary>
  38. event EventHandler<CommandUpdateEventArgs<TCommand>> Updated;
  39. /// <summary>
  40. /// Occurs when [error].
  41. /// </summary>
  42. event EventHandler<ErrorEventArgs> Error;
  43. }
  44. }