/// <summary>
 /// Initialises a new instance of the ServerCommands class.
 /// </summary>
 /// <param name="server">The instance of the Server running.</param>
 /// <param name="registry">A CommandRegistry to register commands to.</param>
 public ServerCommands(Server server, CommandRegistry<ServerCommand> registry)
 {
     _server = server;
     _registry = registry;
     _registry.Register(new ServerCommand("broadcast", false, Broadcast, "Broadcasts a message to every connected client."));
     _registry.Register(new ServerCommand("help", false, Help, "Provides help for the command utility."));
     _registry.Register(new ServerCommand("ban", true, BanUser, "Bans a user from the server, never to return!"));
     _registry.Register(new ServerCommand("kick", true, KickUser, "Kicks a user from their session. They may reconnect, but their sessions will be read-only until the server is restarted."));
     _registry.Register(new ServerCommand("restart", true, Restart, "Restarts the server, notifying clients that it's happening."));
     _registry.Register(new ServerCommand("privileged", false, ListPrivileged, "Gives a list of all the privileged users."));
     _registry.Register(new ServerCommand("banned", false, ListBanned, "Gives a list of all the banned users."));
 }
 /// <summary>
 /// Initialises a new instance of the ServerWindow class and sets up the required values and
 /// objects for use.
 /// </summary>
 public ServerWindow()
 {
     InitializeComponent();
     _logger = new Logger();
     _logger.IsEnabled = true;
     Overlay.Background = new SolidColorBrush((Color)ColorConverter.ConvertFromString("#44FFFFFF"));
     this.Log("Loading Messenger::Server modules");
     this.Log("Creating Server instance...");
     _server = new Server(this, 25958);
     this.Log("Server instance {0} on port {1}", _server, _server.Port);
     this.Log("Log location: {0}", _logger.LogDirectory + "\\" + _logger.LogFile);
     new Thread(FinishLoadingThread).Start();
     _server.Start();
 }
 /// <summary>
 /// Initialises a new instance of the ServerWindow class and sets up the required values and
 /// objects for use.
 /// </summary>
 public ServerWindow(bool crashRecovery)
 {
     InitializeComponent();
     _logger = new Logger();
     _logger.IsEnabled = true;
     Overlay.Background = new SolidColorBrush((Color)ColorConverter.ConvertFromString("#44FFFFFF"));
     this.Log("Loading Messenger::Server modules");
     this.Log("Creating Server instance...");
     RunningServer = new Server(this, this.GetPort());
     this.Log("Server instance {0} on port {1}", RunningServer, RunningServer.Port);
     this.Log("Log location: {0}", _logger.LogDirectory + "\\" + _logger.LogFile);
     new Thread(FinishLoadingThread).Start();
     RunningServer.Start();
     _commands = new CommandRegistry<ServerCommand>();
     new ServerCommands(RunningServer, _commands);
 }
 /// <summary>
 /// Initialises a new instance of the ServerCommunicationThread class.
 /// </summary>
 /// <param name="client">The TcpClient whose communications this thread will handle.</param>
 /// <param name="username">The username of the TcpClient.</param>
 /// <param name="console">The ServerWindow object containing the output console.</param>
 public ServerCommunicationThread(TcpClient client, string username, ServerWindow console, Server server)
 {
     _username = username;
     _console = console;
     new Thread(new ParameterizedThreadStart(ThreadMethod)).Start(new ServerCommunicationState(client, console, server));
 }
 public ServerCommunicationState(TcpClient client, ServerWindow window, Server server)
 {
     Client = client;
     Window = window;
     Server = server;
 }