Ejemplo n.º 1
0
        public DirectoryWatchService(
            DirectoryWatchConfig config,
            ICommandArgsService processFileCommandArgsService,
            IDirectoryWatcher directoryWatcher)
        {
            this.Config = config;
            this.ProcessFileCommandArgsService = processFileCommandArgsService;

            this.DirectoryWatcher          = directoryWatcher;
            this.DirectoryWatcher.Changed += _fileSystemWatcher_Changed;
        }
Ejemplo n.º 2
0
        public void Constructor_Sets_Properties()
        {
            //{
            //    WatchDirectory = "watchDirectory",
            //    Filter = "*.mock",
            //    ProcessFileMode = ProcessFileMode.Changed,
            //    ExecutablePath = "executablePath",
            //    ExecutableArgs = new string[] { }
            //};

            DirectoryWatchConfig       config             = new DirectoryWatchConfig();
            Mock <ICommandArgsService> commandArgsService = new Mock <ICommandArgsService>();
            Mock <IDirectoryWatcher>   directoryWatcher   = new Mock <IDirectoryWatcher>();

            this.Instance = new DirectoryWatchService(
                config,
                commandArgsService.Object,
                directoryWatcher.Object);

            Assert.AreEqual(config, this.Instance.Config);
        }
Ejemplo n.º 3
0
        public SupervisorActor(IInjectorService injector, DirectoryWatchConfig config)
        {
            _injector    = injector;
            _config      = config;
            _watchActors = new();
            _configActor = CreateConfigActor();
            _scanActor   = CreateScanActor();

            _supportedTypes = new string[]
            { AddWatchDirectory, RemoveWatchDirectory, DirectoryScan };

            _log = injector.GetService <ILogService>()
                   .GetContextLogger <SupervisorActor>();

            foreach (var d in config.Directories)
            {
                StartWatchActor(d);
            }

            Receive <IEvent>(OnEvent);
        }
Ejemplo n.º 4
0
 public async Task OnConfig(DirectoryWatchConfig config)
 {
     _log.Debug($"Saving settings for directory watch plugin");
     await _config.SaveConfig(Guid.Parse(Info.ID), config);
 }