public Task StartAsync(CancellationToken cancellationToken) { _sources = ConfigValueProvider.GetArray("FSW:FSWSource"); List <string> fileTypes = ConfigValueProvider.GetArray("FSW:FileTypes"); bool incSubDir = false; bool.TryParse(ConfigValueProvider.Get("FSW:FSWSubDir"), out incSubDir); FileWatchExecutor.OnFileReady += OnFileReady; FileWatchExecutor.Instance.Watch(_sources.ToArray(), fileTypes, incSubDir); Log.Information($"[{nameof(FileWatcherService)}] has been started"); return(Task.CompletedTask); }
private static void OnFileReady(object sender, FileSystemEventArgs e) { string assem = ConfigValueProvider.Get("FSW:DynamicAssembly"), type = ConfigValueProvider.Get("FSW:DynamicType"); ExecPlugin(assem, type, e); }