static DatabaseManager() { s_DatabaseHashtable = new Dictionary<string,Database>(); s_FileChangeHandler = new FileSystemChangeEventHandler(500); s_FileChangeHandler.ActualHandler += new FileSystemEventHandler(OnFileChanged); _commonConfigInstance = DbInstanceManager.CreateDbInance(); // set up file system watcher string databaseFolder = Path.GetDirectoryName(_commonConfigInstance.DatabaseConfigFile); string databaseFile = Path.GetFileName(_commonConfigInstance.DatabaseConfigFile); s_Watcher = new FileSystemWatcher(databaseFolder); s_Watcher.Filter = databaseFile; s_Watcher.NotifyFilter = NotifyFilters.LastWrite | NotifyFilters.CreationTime; s_Watcher.Changed += new FileSystemEventHandler(s_FileChangeHandler.ChangeEventHandler); s_Watcher.EnableRaisingEvents = true; // load database s_DatabaseHashtable = LoadDatabaseList(); }
static DataCommandManager() { _commonConfigInstance = DbInstanceManager.CreateDbInance(); s_FileChangeHandler = new FileSystemChangeEventHandler(FILE_CHANGE_NOTIFICATION_INTERVAL); s_FileChangeHandler.ActualHandler += new FileSystemEventHandler(Watcher_Changed); s_DataFileFolder = Path.GetDirectoryName(_commonConfigInstance.DataCommandFileListConfigFile); s_CommandSyncObject = new object(); s_CommandFileListSyncObject = new object(); if (s_DataFileFolder == null || !Directory.Exists(s_DataFileFolder)) { return; } s_Watcher = new FileSystemWatcher(s_DataFileFolder); s_Watcher.NotifyFilter = NotifyFilters.LastWrite | NotifyFilters.CreationTime; s_Watcher.Changed += new FileSystemEventHandler(s_FileChangeHandler.ChangeEventHandler); s_Watcher.EnableRaisingEvents = true; UpdateAllCommandFiles(); }