/// <summary> /// Detaches the current monitor from the server /// </summary> public void DetachMonitor() { if (this._activeLogger != null) { this._server.RemoveLogger(this._activeLogger); this._activeLogger = null; } if (this._activeConsole != null) { if (this._server.Console is MulticastConsole) { ((MulticastConsole)this._server.Console).RemoveConsole(this._activeConsole); } this._activeConsole = null; } }
/// <summary> /// Attaches a Monitor to the Server /// </summary> /// <param name="monitor">Monitor</param> public void AttachMonitor(ServerMonitor monitor) { this.DetachMonitor(); //Set up logger this._activeLogger = new MonitorLogger(monitor, this._logFormat); this._server.AddLogger(this._activeLogger); //Set up console this._activeConsole = new MonitorConsole(monitor); if (this._server.Console is MulticastConsole) { ((MulticastConsole)this._server.Console).AddConsole(this._activeConsole); } else { IServerConsole current = this._server.Console; IServerConsole multicast = new MulticastConsole(new IServerConsole[] { current, this._activeConsole }); this._server.Console = multicast; } }