private void ForwardMessageToAllUsers(string message)
        {
            lock (usersLocker)
            {
                string[] messageArray = message.Split('-');

                if (messageArray.Length == 3)
                {
                    bool verifiedMessage = false;

                    for (int i = 0; i < this.users.Count; i++)
                    {
                        if (this.users[i].Username == messageArray[0] && this.users[i].SessionKey == messageArray[2])
                        {
                            verifiedMessage = true;
                            break;
                        }
                    }

                    if (verifiedMessage == true)
                    {
                        for (int i = 0; i < this.users.Count; i++)
                        {
                            this.users[i].NetworkWatcher.Send(ProtocolCreator.NewMessage(messageArray[0] + ": " + messageArray[1]));
                        }
                    }
                }
            }
        }
        private void RemoveUser(string username, string sessionkey)
        {
            lock (usersLocker)
            {
                // Verifys session key of the logout request
                bool legitSessionKey = false;

                for (int i = 0; i < this.users.Count; i++)
                {
                    if (this.users[i].Username == username && this.users[i].SessionKey == sessionkey)
                    {
                        legitSessionKey = true;
                        break;
                    }
                }

                if (legitSessionKey == true)
                {
                    for (int i = 0; i < this.users.Count; i++)
                    {
                        if (this.users[i].Username == username)
                        {
                            this.AddLineToLog(username + " (" + ((IPEndPoint)this.users[i].NetworkWatcher.Client.Client.RemoteEndPoint).Address.ToString() + ")" + " logged out!");
                            this.users[i].NetworkWatcher.Stop();
                            this.users.Remove(this.users[i]);
                            break;
                        }
                    }
                }

                // Sends all users the user who logged out
                for (int i = 0; i < this.users.Count; i++)
                {
                    this.users[i].NetworkWatcher.Send(ProtocolCreator.RemoveUser(username));
                    this.users[i].NetworkWatcher.Send(ProtocolCreator.NewMessage("SERVER: " + username + " logged out!"));
                }
            }
        }
        private void FinishUserLogin(string username, string sessionkey)
        {
            lock (usersLocker)
            {
                NetworkWatcher networkWatcher = null;

                // Gets the networkWatcher of the new user
                for (int i = 0; i < this.users.Count; i++)
                {
                    if (this.users[i].Username == username && this.users[i].SessionKey == sessionkey)
                    {
                        networkWatcher = this.users[i].NetworkWatcher;
                    }
                }

                if (networkWatcher != null)
                {
                    // Sends the new user all online users
                    for (int i = 0; i < this.users.Count; i++)
                    {
                        if (this.users[i].Username != username)
                        {
                            networkWatcher.Send(ProtocolCreator.AddUser(this.users[i].Username));
                        }
                    }

                    // Sends all users the user who logged in
                    for (int i = 0; i < this.users.Count; i++)
                    {
                        this.users[i].NetworkWatcher.Send(ProtocolCreator.AddUser(username));
                        this.users[i].NetworkWatcher.Send(ProtocolCreator.NewMessage("SERVER: " + username + " logged in!"));
                    }

                    this.AddLineToLog(username + " (" + ((IPEndPoint)networkWatcher.Client.Client.RemoteEndPoint).Address.ToString() + ")" + " logged in!");
                }
            }
        }