1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374 |
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using SuperSocket.Common;
- using SuperSocket.SocketBase.Config;
- namespace SuperSocket.SocketBase.Command
- {
-
-
-
- public abstract class CommandLoaderBase<TCommand> : ICommandLoader<TCommand>
- where TCommand : ICommand
- {
-
-
-
-
-
-
- public abstract bool Initialize(IRootConfig rootConfig, IAppServer appServer);
-
-
-
-
-
- public abstract bool TryLoadCommands(out IEnumerable<TCommand> commands);
-
-
-
-
- protected void OnUpdated(IEnumerable<CommandUpdateInfo<TCommand>> commands)
- {
- var handler = Updated;
- if (handler != null)
- handler(this, new CommandUpdateEventArgs<TCommand>(commands));
- }
-
-
-
- public event EventHandler<CommandUpdateEventArgs<TCommand>> Updated;
-
-
-
-
- protected void OnError(string message)
- {
- OnError(new Exception(message));
- }
-
-
-
-
- protected void OnError(Exception e)
- {
- var handler = Error;
- if (handler != null)
- handler(this, new ErrorEventArgs(e));
- }
-
-
-
- public event EventHandler<ErrorEventArgs> Error;
- }
- }
|