Esempio n. 1
0
        public bool ActivityIsOpen(string version, int activityId)
        {
            try
            {
                var cache = new ActivityModelMemoryCache();
                return(cache.isActivity(version, activityId));
            }
            catch (Exception e)
            {
                ConsoleLog.showErrorInfo(0, "GameConfigMgr isOpen " + e.Message);
                return(false);
            }

/*
 *          try
 *          {
 *              if(_rwLock.TryEnterReadLock(_readWaiteTime))
 *              {
 *                  try
 *                  {
 *                      GameConfigActivity config = _configDic[(int)EnumConfigFileType.Activity] as GameConfigActivity;
 *                      return config.isOpen(version, activityId);
 *                  }
 *                  finally
 *                  {
 *                      if (_rwLock.IsReadLockHeld) _rwLock.ExitReadLock();
 *                  }
 *              }
 *              else
 *              {
 *                  return false;
 *              }
 *          }
 *          catch (Exception e)
 *          {
 *              ConsoleLog.showErrorInfo(0, "GameConfigMgr getData" + e.Message);
 *              return false;
 *          }
 */
        }
Esempio n. 2
0
        public void getActivityDate(List <ConfigData> outData, string version)
        {
            DateTime now   = DateTime.Now;
            var      cache = new ActivityModelMemoryCache();

            cache.Foreach((string s, memoryActivityModel mam) =>
            {
                if (mam.version != version || false == mam.isOpen())
                {
                    return(true); // next
                }
                var data      = mam;
                ConfigData cd = new ConfigData();
                cd.ext        = new List <ushort>();
                cd.type       = mam.type;
                cd.ext.Add(mam.activityid);
                foreach (ushort us in data.parms)
                {
                    cd.ext.Add(us);
                }

                TimeSpan span = data.end - now;
                cd.ext.Add((ushort)span.Days);
                cd.ext.Add((ushort)span.Hours);
                cd.ext.Add((ushort)span.Minutes);
                cd.ext.Add((ushort)span.Seconds);
                cd.ext.Add((ushort)data.begin.Month);
                cd.ext.Add((ushort)data.begin.Day);
                cd.ext.Add((ushort)data.begin.Hour);
                cd.ext.Add((ushort)data.begin.Minute);
                cd.ext.Add((ushort)data.end.Month);
                cd.ext.Add((ushort)data.end.Day);
                cd.ext.Add((ushort)data.end.Hour);
                cd.ext.Add((ushort)data.end.Minute);
                outData.Add(cd);
                return(true);
            });
        }
Esempio n. 3
0
 public void toMemoryActivityModel()
 {
     CacheFactory.tryRemoveMemoryCache(typeof(memoryActivityModel).ToString());
     var memoryCache = new ActivityModelMemoryCache();
 }