コード例 #1
0
        public void StopWatchingFiles()
        {
            LogFileUpdateHandler.Reset();

            _watcher.EnableRaisingEvents = false;
            foreach (var agentLogConsumer in Consumers)
            {
                agentLogConsumer.OnStoped();
            }
        }
コード例 #2
0
        public void StartWatchingFiles(bool debugMode, string path, string fileFilter, params IAgentLogConsumer[] consumers)
        {
            LogFileUpdateHandler.Reset();

            Consumers                      = consumers.ToList();
            _watcher.Path                  = path;
            _watcher.NotifyFilter          = NotifyFilters.LastWrite;
            _watcher.Filter                = fileFilter;
            _watcher.Changed              += OnChanged;
            _watcher.IncludeSubdirectories = true;
            _watcher.EnableRaisingEvents   = true;
            foreach (var agentLogConsumer in Consumers)
            {
                agentLogConsumer.Start(debugMode);
            }
        }
コード例 #3
0
        private void OnChanged(object source, FileSystemEventArgs e)
        {
            var path = e.FullPath;

            LogFileUpdateHandler.HandleFileChangeEvent(Consumers, path);
        }