Ejemplo n.º 1
0
        public ServerCommandHost(IServer commandHost)
        {
            Guard.That(commandHost, "Command host must not be null").IsNotNull();

            this.commandHost = commandHost;
            executioners     = new Stack <ICommandExecutioner>();
            commandTable     = new Dictionary <string, CommandInfo>();

            EchoToAll = new DebugHost();
            EchoToAll.RegisterAppender(new ActionAppender(commandHost.NotifyAll));

            //Setup echo to respond only to the defined connection
            Echo = (msg, connection) =>
            {
                var om = commandHost.CreateMessage();
                var serverNotification = new Notification(msg, NotificationType.Message);
                MessageSerializer.Encode(serverNotification, ref om);
                GemNetworkDebugger.Append.Info(msg);
                commandHost.SendOnlyTo(om, connection);
            };

            RegisterHelpComand();
            RegisterSetPasswordCommand();
            RegisterEchoCommand();
            RegisterKickCommand();
            RegisterViewClientsCommand();

            //the default password
            Password = "******";
        }
Ejemplo n.º 2
0
 public void RegisterAppender(IAppender appender)
 {
     EchoToAll.RegisterAppender(appender);
 }