Esempio n. 1
0
        public static bool ReLoad()
        {
            try
            {
                m_lock.AcquireWriterLock(Timeout.Infinite);
                try
                {
                    using (ServiceBussiness db = new ServiceBussiness())
                    {
                        _RateInfo = db.GetExperienceRate(WorldMgr.ServerID);
                    }

                    if (_RateInfo == null)
                    {
                        _RateInfo = new ExperienceRateInfo();
                        _RateInfo.Rate = -1;
                    }

                    return true;
                }
                catch{ }
                finally
                {
                    m_lock.ReleaseWriterLock();
                }                
            }
            catch (Exception e)
            {
                if (log.IsErrorEnabled)
                    log.Error("ExperienceRateMgr", e);
            }

            return false;
        }
Esempio n. 2
0
        public static bool Init()
        {
            try
            {
                //_RateInfo = new ExperienceRateInfo();
                //_RateInfo.Rate = 1;
                m_lock = new System.Threading.ReaderWriterLock();

                using (ServiceBussiness db = new ServiceBussiness())
                {
                    _RateInfo = db.GetExperienceRate(WorldMgr.ServerID);
                }

                if (_RateInfo == null)
                {
                    _RateInfo = new ExperienceRateInfo();
                    _RateInfo.Rate = -1;
                }

                return true;
            }
            catch (Exception e)
            {
                if (log.IsErrorEnabled)
                    log.Error("ExperienceRateMgr", e);
                return false;
            }

        }