private void scareCrow_Changed(object sender, FileSystemEventArgs e) { string fileName = e.Name.ToLower(); if (File.GetAttributes(e.FullPath) == FileAttributes.Directory) { return; } using (filesLock.Upgrade()) { if (pendingFileReloads.Contains(fileName) || !ContainsFile(fileName)) return; pendingFileReloads.Add(fileName); } CountdownTimer timer = new CountdownTimer(); timer.BeginCountdown(changeFileDelay, DelayedProcessFileChanged, fileName); }
private void scareCrow_Changed(object sender, FileSystemEventArgs e) { try { string fileName = e.Name.ToLower(); using (fileLoadResourceLock.WaitToWrite()) { if (pendingFileReloads.Contains(fileName) || !ContainsFile(fileName)) { return; } pendingFileReloads.Add(fileName); } CountdownTimer timer = new CountdownTimer(); timer.BeginCountdown(CHANGE_FILE_DELAY, DelayedProcessFileChanged, fileName); } catch (Exception ex) { logger.HandleException(ex, "FileWatcher"); } }
private void scareCrow_Changed(object sender, FileSystemEventArgs e) { try { string fileName = e.Name; using (fileLoadResourceLock.AcquireWriterLock()) { if (pendingFileReloads.Contains(fileName) || !ContainsFile(fileName)) { return; } pendingFileReloads.Add(fileName); } CountdownTimer timer = new CountdownTimer(); timer.BeginCountdown(ConfigurationConst.CHANGE_FILE_DELAY, DelayedProcessFileChanged, fileName); } catch (Exception ex) { _logger.LogError(ex, "FileWatcher Error"); } }