using System; using System.Collections.Generic; using System.Linq; using System.Text; using Holo.Managers; using System.Collections; using Ion.Storage; using System.Threading; namespace Holo.Source.GameConnectionSystem { class connectionHelper { private static Hashtable Connections = new Hashtable(); private static Thread Checker = new Thread(new ThreadStart(CheckSockets)); internal static void Init() { Checker.Start(); } public static bool IpIsBanned(string IP) { string banReason = userManager.getBanReason(IP); if (banReason != "") return true; else return false; } private static void CheckSockets() { while (true) { Hashtable TMP = Connections; foreach (gameConnection EndPoint in TMP.Values) { if (!EndPoint.IsActive) EndPoint.Close(); } Thread.Sleep(2000); // 2 secconds } } internal static void AddConnection(gameConnection Endpoint, int ConnectionID) { if (Connections.ContainsValue(ConnectionID)) Connections.Remove(ConnectionID); Connections.Add(ConnectionID, Endpoint); } internal static void RemoveConnection(int ID) { if (Connections.ContainsValue(ID)) Connections.Remove(ID); } } }