static DataCommandDetector() { s_FileChangeHandler = new FileSystemChangeEventHandler(Configer.FileChangeInteravl); s_FileChangeHandler.ActualHandler += Watcher_Changed; s_DataFileFolder = Path.GetDirectoryName(Configer.DataCommandFileListConfigFile); s_CommandSyncObject = new object(); s_CommandFileListSyncObject = new object(); if (s_DataFileFolder != null) { s_Watcher = new FileSystemWatcher(s_DataFileFolder); s_Watcher.NotifyFilter = NotifyFilters.LastWrite | NotifyFilters.CreationTime; s_Watcher.Changed += s_FileChangeHandler.ChangeEventHandler; s_Watcher.EnableRaisingEvents = true; UpdateAllCommandFiles(); } }
static DatabaseDetector() { string databaseFolder = String.Empty; string databaseFile = String.Empty; databaseFolder = Path.GetDirectoryName(Configer.ServerListFileLocation); databaseFile = Path.GetFileName(Configer.ServerListFileLocation); s_DatabaseHashtable = new Dictionary<string, DbUtility>(); s_FileChangeHandler = new FileSystemChangeEventHandler(Configer.FileChangeInteravl); s_FileChangeHandler.ActualHandler += OnFileChanged; if (databaseFolder != null) { s_Watcher = new FileSystemWatcher(databaseFolder); s_Watcher.Filter = databaseFile; s_Watcher.NotifyFilter = NotifyFilters.LastWrite | NotifyFilters.CreationTime; s_Watcher.Changed += s_FileChangeHandler.ChangeEventHandler; s_Watcher.EnableRaisingEvents = true; s_DatabaseHashtable = LoadDatabaseList(); } }