Beispiel #1
0
        static void Main(string[] args)
        {
            IWatcher watcher = null;

            try
            {
                IConfigurator configurator = new MainConfigurator();
                watcher = configurator.GetWatcher();

                watcher.Start();

                Console.WriteLine("FileWatcher started.");
                Console.WriteLine("Press 'q' to end.");
                while (Console.ReadKey().KeyChar != 'q')
                {
                    ;
                }
            }
            catch (ArgumentException ex)
            {
                ExceptionHandle(ex);
            }
            catch (UnauthorizedAccessException ex)
            {
                ExceptionHandle(ex);
            }
            catch (DirectoryNotFoundException ex)
            {
                ExceptionHandle(ex);
            }
            finally
            {
                watcher?.Dispose();
            }
        }
        protected override void OnStart(string[] args)
        {
            IReaderService readerService = new ReaderService();
            IWSListener    listener      = new WSListener(readerService);

            _watcher.LogEvent += m => listener.Log(m);
            _watcher.Start();
        }
Beispiel #3
0
        public void Start(string projectName)
        {
            // TODO: Should scan all the files in the project folder
            // and create an initial entry.

            Project       project      = _repository.LoadProject(projectName);
            IFileChangeBL fileChangeBL = new FileChangeBL();

            _fileWatcher = _fileWatcherFactory.Create(_repository, fileChangeBL, project);
            _fileWatcher.Start();
        }
Beispiel #4
0
        public void StartWatching(string pathFile)
        {
            var manager = Configurator.CreateManager(new DependencyManager());

            _watcher           = manager.CreateWatcher(pathFile);
            _watcher.LogEvent += s => Console.WriteLine(s);
            _watcher.Start();
            IReaderService   readerService = new ReaderService();
            IWatcherListener listener      = new WatcherListener(readerService);

            _watcher.Created += m => listener.OnCreated(m);
        }
Beispiel #5
0
 private void DoScan()
 {
     try
     {
         IsScanning = true;
         _watcher.Start();
     }
     catch (Exception err)
     {
         Mvx.Error(err.ToString());
     }
 }
        public void Start(params InputType[] inputs)
        {
            var settings = settingsService.Settings;

            logger.LogDebug("Start watchers...");

            if (inputs.Contains(InputType.Exams))
            {
                examWatcher.Start();
            }

            if (inputs.Contains(InputType.Rooms))
            {
                roomWatcher.Start();
            }

            if (inputs.Contains(InputType.Substitutions))
            {
                substitutionWatcher.Start();
            }

            if (inputs.Contains(InputType.Supervisions))
            {
                supervisionWatcher.Start();
            }

            if (inputs.Contains(InputType.Timetable))
            {
                timetableWatcher.Start();
            }

            if (inputs.Contains(InputType.Tuitions))
            {
                tuitionWatcher.Start();
            }

            logger.LogInformation("Export service started.");
        }
Beispiel #7
0
        public void EnableWatcherTest()
        {
            _watcher.Start();

            Assert.IsTrue(((Watcher)_watcher).IsRunning);
        }
Beispiel #8
0
        public Task StartAsync(CancellationToken cancellationToken)
        {
            _watcher.Start();

            return(Task.CompletedTask);
        }
 public void Start()
 {
     _fileWatcher.Start();
     _settingsWatcher.Start();
     _logger.Information("Client started.");
 }
Beispiel #10
0
 public void Run()
 {
     _watcher.OnCreated += OnChanged;
     _watcher.Start();
 }