void DisconnectUser(object sender, EventArgs e) { if (lstOnlineUsers.SelectedItems.Count == 0) { return; } string SelectedConnection_SessionID = lstOnlineUsers.SelectedItems[0].SubItems[0].Text; foreach (FTPClient ConnectedUser in ApplicationSettings.FtpServer.FTPClients) { if (ConnectedUser.SessionID == SelectedConnection_SessionID) { ConnectedUser.Disconnect(); break; } } RefreshUsersList(null, null); }
public static void addUser(int userID, ConnectedUser User) { if (_Users.ContainsKey(userID)) { ConnectedUser oldUser = ((ConnectedUser)_Users[userID]); oldUser.Disconnect(); if (_Users.ContainsKey(userID)) { _Users.Remove(userID); } } _Users.Add(userID, User); Config.Debug.WriteLine("[" + User.connectionID + "]" + " User [" + User._UserID + "] connected."); if (_Users.Count > _peakUserCount) { _peakUserCount = _Users.Count; } MySQL.runQuery("UPDATE store_values SET value = '" + _Users.Count + "' WHERE name = 'jabbos_online'"); }