using System; using System.Collections.Generic; using System.Linq; using System.Text; using SuperSocket.Common; using SuperSocket.SocketBase.Config; namespace SuperSocket.SocketBase.Command { /// /// CommandLoader base class /// public abstract class CommandLoaderBase : ICommandLoader where TCommand : ICommand { /// /// Initializes the command loader by the root config and appserver instance. /// /// The root config. /// The app server. /// public abstract bool Initialize(IRootConfig rootConfig, IAppServer appServer); /// /// Tries to load commands. /// /// The commands. /// public abstract bool TryLoadCommands(out IEnumerable commands); /// /// Called when [updated]. /// /// The commands. protected void OnUpdated(IEnumerable> commands) { var handler = Updated; if (handler != null) handler(this, new CommandUpdateEventArgs(commands)); } /// /// Occurs when [updated]. /// public event EventHandler> Updated; /// /// Called when [error]. /// /// The message. protected void OnError(string message) { OnError(new Exception(message)); } /// /// Called when [error]. /// /// The e. protected void OnError(Exception e) { var handler = Error; if (handler != null) handler(this, new ErrorEventArgs(e)); } /// /// Occurs when [error]. /// public event EventHandler Error; } }