public static void Run()
        {
            //get folder to watch path from appsettings.json

            var FSWSource = ConfigValueProvider.Get("FSW:FSWSource");

            //get file types from appsettings.json

            List <string> fileTypes = ConfigValueProvider.GetArray("FSW:FileTypes");

            //register our events

            FilesWatcher.OnFileReady  += OnFileReady;
            FilesWatcher.OnNewMessage += OnNewMessage;
            FilesWatcher.Instance.Watch(FSWSource, fileTypes);
        }
Exemplo n.º 2
0
 void ReadAllSettings()
 {
     try
     {
         LogFileReadyEvents = bool.Parse(ConfigValueProvider.Get("FSW:LogFileReadyEvents"));
         LogFSWEvents       = bool.Parse(ConfigValueProvider.Get("FSW:LogFSWEvents"));
         FSWUseRegex        = bool.Parse(ConfigValueProvider.Get("FSW:FSWUseRegex"));
         FSWRegex           = ConfigValueProvider.Get("FSW:FSWRegex");
         WatchKinds         = ConfigValueProvider.GetArray("FSW:WatchKinds");
         if (LogFSWEvents)
         {
             Log.Information($"[Event] Time: (DateTime.Now.TimeOfDay)\t LogFileReadyEvents:[{ LogFileReadyEvents}],LogFSWEvents:[{LogFSWEvents}]");
         }
     }
     catch (Exception ex)
     {
         Log.Error(ex, "FileWatchExecutor.ReadAllSettings()");
     }
 }