/// <summary>
        /// Called for each time the timer ticks.
        /// </summary>
        /// <param name="State"></param>
        public void Run(object State)
        {
            try
            {
                if (_disabled)
                {
                    return;
                }

                if (_timerRunning)
                {
                    _timerLagging = true;
                    return;
                }

                _resetEvent.Reset();

                // BEGIN CODE
                List <UserCache> CacheList = BiosEmuThiago.GetGame().GetCacheManager().GetUserCache().ToList();
                if (CacheList.Count > 0)
                {
                    foreach (UserCache Cache in CacheList)
                    {
                        try
                        {
                            if (Cache == null)
                            {
                                continue;
                            }

                            UserCache Temp = null;

                            if (Cache.isExpired())
                            {
                                BiosEmuThiago.GetGame().GetCacheManager().TryRemoveUser(Cache.Id, out Temp);
                            }

                            Temp = null;
                        }
                        catch (Exception e)
                        {
                            ExceptionLogger.LogException(e);
                        }
                    }
                }

                CacheList = null;

                List <Habbo> CachedUsers = BiosEmuThiago.GetUsersCached().ToList();
                if (CachedUsers.Count > 0)
                {
                    foreach (Habbo Data in CachedUsers)
                    {
                        try
                        {
                            if (Data == null)
                            {
                                continue;
                            }

                            Habbo Temp = null;

                            if (Data.CacheExpired())
                            {
                                BiosEmuThiago.RemoveFromCache(Data.Id, out Temp);
                            }

                            if (Temp != null)
                            {
                                Temp.Dispose();
                            }

                            Temp = null;
                        }
                        catch (Exception e)
                        {
                            ExceptionLogger.LogException(e);
                        }
                    }
                }

                CachedUsers = null;
                // END CODE

                // Reset the values
                _timerRunning = false;
                _timerLagging = false;

                _resetEvent.Set();
            }
            catch (Exception e)
            {
                ExceptionLogger.LogException(e);
            }
        }
Beispiel #2
0
        /// <summary>
        /// Called for each time the timer ticks.
        /// </summary>
        /// <param name="state"></param>
        public void Run(object state)
        {
            try
            {
                if (_disabled)
                {
                    return;
                }

                if (_timerRunning)
                {
                    _timerLagging = true;
                    return;
                }

                _resetEvent.Reset();

                // BEGIN CODE
                List <UserCache> cacheList = PlusEnvironment.GetGame().GetCacheManager().GetUserCache().ToList();
                if (cacheList.Count > 0)
                {
                    foreach (UserCache cache in cacheList)
                    {
                        try
                        {
                            if (cache == null)
                            {
                                continue;
                            }

                            if (cache.IsExpired())
                            {
                                PlusEnvironment.GetGame().GetCacheManager().TryRemoveUser(cache.Id, out _);
                            }
                        }
                        catch (Exception e)
                        {
                            ExceptionLogger.LogException(e);
                        }
                    }
                }

                List <Habbo> cachedUsers = PlusEnvironment.GetUsersCached().ToList();
                if (cachedUsers.Count > 0)
                {
                    foreach (Habbo data in cachedUsers)
                    {
                        try
                        {
                            if (data == null)
                            {
                                continue;
                            }

                            Habbo temp = null;

                            if (data.CacheExpired())
                            {
                                PlusEnvironment.RemoveFromCache(data.Id, out temp);
                            }

                            if (temp != null)
                            {
                                temp.Dispose();
                            }
                        }
                        catch (Exception e)
                        {
                            ExceptionLogger.LogException(e);
                        }
                    }
                }
                // END CODE

                // Reset the values
                _timerRunning = false;
                _timerLagging = false;

                _resetEvent.Set();
            }
            catch (Exception e)
            {
                ExceptionLogger.LogException(e);
            }
        }
Beispiel #3
0
        /// <summary>
        /// Called for each time the timer ticks.
        /// </summary>
        /// <param name="State"></param>
        public void Run(object State)
        {
            try
            {
                if (this._disabled)
                {
                    return;
                }

                if (this._timerRunning)
                {
                    this._timerLagging = true;
                    return;
                }

                this._resetEvent.Reset();

                // BEGIN CODE
                List <UserCache> CacheList = QuasarEnvironment.GetGame().GetCacheManager().GetUserCache().ToList();
                if (CacheList.Count > 0)
                {
                    foreach (UserCache Cache in CacheList)
                    {
                        try
                        {
                            if (Cache == null)
                            {
                                continue;
                            }

                            UserCache Temp = null;

                            if (Cache.isExpired())
                            {
                                QuasarEnvironment.GetGame().GetCacheManager().TryRemoveUser(Cache.Id, out Temp);
                            }

                            Temp = null;
                        }
                        catch (Exception e)
                        {
                            Logging.LogCacheException(e.ToString());
                        }
                    }
                }

                CacheList = null;

                List <Habbo> CachedUsers = QuasarEnvironment.GetUsersCached().ToList();
                if (CachedUsers.Count > 0)
                {
                    foreach (Habbo Data in CachedUsers)
                    {
                        try
                        {
                            if (Data == null)
                            {
                                continue;
                            }

                            Habbo Temp = null;

                            if (Data.CacheExpired())
                            {
                                QuasarEnvironment.RemoveFromCache(Data.Id, out Temp);
                            }

                            if (Temp != null)
                            {
                                Temp.Dispose();
                            }

                            Temp = null;
                        }
                        catch (Exception e)
                        {
                            Logging.LogCacheException(e.ToString());
                        }
                    }
                }

                CachedUsers = null;
                // END CODE

                // Reset the values
                this._timerRunning = false;
                this._timerLagging = false;

                this._resetEvent.Set();
            }
            catch (Exception e) { Logging.LogCacheException(e.ToString()); }
        }
Beispiel #4
0
        public void Run(object state)
        {
            try
            {
                if (_disabled)
                {
                    return;
                }

                if (_timerRunning)
                {
                    _timerLagging = true;
                    return;
                }

                _resetEvent.Reset();

                // BEGIN CODE
                var cacheList = Program.GameContext.GetCacheManager().GetUserCache().ToList();
                if (cacheList.Count > 0)
                {
                    foreach (var cache in cacheList)
                    {
                        try
                        {
                            if (cache == null)
                            {
                                continue;
                            }

                            if (cache.IsExpired())
                            {
                                Program.GameContext.GetCacheManager().TryRemoveUser(cache.Id, out _);
                            }
                        }
                        catch (Exception e)
                        {
                            Logger.Error(e);
                        }
                    }
                }

                var cachedUsers = HabboFactory.GetUsersCached().ToList();
                if (cachedUsers.Count > 0)
                {
                    foreach (var data in cachedUsers)
                    {
                        try
                        {
                            if (data == null)
                            {
                                continue;
                            }

                            Habbo temp = null;

                            if (data.CacheExpired())
                            {
                                HabboFactory.RemoveFromCache(data.Id, out temp);
                            }

                            if (temp != null)
                            {
                                temp.Dispose();
                            }
                        }
                        catch (Exception e)
                        {
                            Logger.Error(e);
                        }
                    }
                }
                // END CODE

                // Reset the values
                _timerRunning = false;
                _timerLagging = false;

                _resetEvent.Set();
            }
            catch (Exception e)
            {
                Logger.Error(e);
            }
        }
Beispiel #5
0
        public void Run(object State)
        {
            try
            {
                if (Disabled)
                {
                    return;
                }

                if (TimerRunning)
                {
                    TimerLagging = true;
                    return;
                }

                ResetEvent.Reset();
                List <UserCache> CacheList = ProjectHub.GetGame().GetCacheManager().GetUserCache().ToList();

                if (CacheList.Count > 0)
                {
                    foreach (UserCache Cache in CacheList)
                    {
                        try
                        {
                            if (Cache == null)
                            {
                                continue;
                            }

                            UserCache Temp = null;

                            if (Cache.IsExpired())
                            {
                                ProjectHub.GetGame().GetCacheManager().TryRemoveUser(Cache.Id, out Temp);
                            }

                            Temp = null;
                        }
                        catch (Exception Error)
                        {
                            Logging.LogError(Error.ToString());
                        }
                    }
                }

                CacheList = null;
                List <Habbo> CachedUsers = ProjectHub.GetUsersCached().ToList();

                if (CachedUsers.Count > 0)
                {
                    foreach (Habbo Data in CachedUsers)
                    {
                        try
                        {
                            if (Data == null)
                            {
                                continue;
                            }

                            Habbo Temp = null;

                            if (Data.CacheExpired())
                            {
                                ProjectHub.RemoveFromCache(Data.Id, out Temp);
                            }

                            if (Temp != null)
                            {
                                Temp.Dispose();
                            }

                            Temp = null;
                        }
                        catch (Exception Error)
                        {
                            Logging.LogError(Error.ToString());
                        }
                    }
                }

                CachedUsers  = null;
                TimerRunning = false;
                TimerLagging = false;
                ResetEvent.Set();
            }
            catch (Exception Error)
            {
                Logging.LogError(Error.ToString());
            }
        }