/// <summary>
        /// 
        /// </summary>
        public static void Start()
        {
            _refreshTime = DateTime.Now;
            int intervalSecond = GetSection().ProfileCollectInterval;

            _operateTimer = new SyncTimer(obj => WriteToStorage(), 1000, 1000);
            _operateTimer.Start();
            _collectTimer = new SyncTimer(obj => Collect(), 100, intervalSecond * 1000);
            _collectTimer.Start();
            StorageMode = ProfileStorageMode.File;

            if (WorkingLogPath.ToLower().StartsWith("mysql:"))
            {
                StorageMode = ProfileStorageMode.MySql;
                CheckLogTable(typeof(MySqlDataProvider).Name, WorkingLogPath.Substring(6));
            }
            else if (WorkingLogPath.ToLower().StartsWith("sql:"))
            {
                StorageMode = ProfileStorageMode.Sql;
                CheckLogTable(typeof(SqlDataProvider).Name, WorkingLogPath.Substring(4));
            }

        }
예제 #2
0
파일: GameSession.cs 프로젝트: daneric/Scut
 static GameSession() {
     HeartbeatTimeout = 60;//60s
     RequestTimeout = 500;
     Timeout = 2 * 60 * 60;//2H
     clearTime = new SyncTimer(OnClearSession, 6000, 60000);
     clearTime.Start();
     _globalSession = new ConcurrentDictionary<Guid, GameSession>();
     _userHash = new ConcurrentDictionary<int, Guid>();
     _remoteHash = new ConcurrentDictionary<string, Guid>();
     LoadOfflineData();
 }