public FileSystemListener(FileSystemListenerConfig config, ILogger logger) { _config = config ?? throw new ArgumentNullException(nameof(config)); _logger = logger ?? throw new ArgumentNullException(nameof(logger)); _fileSystemWatchers = new List <FileSystemWatcher>(); _fileIndexNumber = 1; _defaultFolderPath = _config.Rules.SingleOrDefault(rule => rule.FilePathTemplate == "default")?.MovingDestinationFolder; }
static void Main(string[] args) { Console.OutputEncoding = Encoding.UTF8; _config = (FileSystemListenerConfig)ConfigurationManager.GetSection("listenerSection"); _logger = new ConsoleLogger(); Thread.CurrentThread.CurrentCulture = new CultureInfo(_config.Culture); Thread.CurrentThread.CurrentUICulture = new CultureInfo(_config.Culture); var fileSystemListener = new FileSystemListener(_config, _logger); fileSystemListener.StartWatching(); Console.ReadKey(); }