Esempio n. 1
0
        static DatabaseManager()
        {
            s_DatabaseInstanceHashtable = new Dictionary<string, DatabaseInstance>();
            s_FileChangeHandler = new FileSystemChangeEventHandler(500);
            s_FileChangeHandler.ActualHandler += new FileSystemEventHandler(OnFileChanged);

            // set up file system watcher
            string databaseFolder = Path.GetDirectoryName(DataAccessSetting.DatabaseConfigFile);
            string databaseFile = Path.GetFileName(DataAccessSetting.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
            LoadDatabaseInstanceList();
        }
        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();
            }
        }
Esempio n. 3
0
        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();
            }
        }