public bool GetIPInBeOperation(TMSKSocket socket, IPOperaType type) { if (type == IPOperaType.BanConnect) { this.processEvent(new IpEventBase(49, socket.AcceptIpAsInt, socket.UserID)); } long ipAsInt = Global.GetIpAsIntSafe(socket); lock (IPStatisticsManager.dictOperaMothod) { IPOperaData oldData = null; if (!IPStatisticsManager.dictOperaMothod.TryGetValue(ipAsInt, out oldData)) { return(false); } if (oldData.recvTicks + (long)(oldData.OperaTime[(int)type] * 1000) > TimeUtil.NOW()) { if (type != IPOperaType.BanConnect) { string userID = socket.UserID; if (!string.IsNullOrEmpty(userID)) { if (this.CheckUserIdValue(userID, "ThisIPPass")) { return(false); } } } LogManager.WriteLog(LogTypes.IPStatistics, string.Format("Operation {0} ip={1}", type.ToString(), Global.GetIPAddress(socket)), null, true); return(true); } } return(false); }
public bool GetUserIDInBeOperation(string userid, IPOperaType type) { lock (this.dictOperaUserID) { UserOperaData oldData = null; if (!this.dictOperaUserID.TryGetValue(userid, out oldData)) { return(false); } if (oldData.createTicks + (long)(oldData.OperaTime[(int)type] * 1000) > TimeUtil.NOW()) { if (this.CheckUserIdValue(userid, "ThisUserIDPass")) { return(false); } LogManager.WriteLog(LogTypes.UserIDStatistics, string.Format("Operation {0} ip={1}", type.ToString(), userid), null, true); return(true); } } return(false); }