private void UpdateLogDescription(object sender, ConfigChangedEventArgs e) { LogDescriptionConfig logDescriptionConfig = CreateLogDescription(e.ConfigPath); RemoveLogDescription(e.ConfigPath); AddLogDescription(e.ConfigPath, logDescriptionConfig); }
public override bool Equals(ChangeMonitorableConfigFile other) { LogDescriptionConfig o = other as LogDescriptionConfig; if (other == null) { return(false); } return(this.Equals(o)); }
public bool Equals(LogDescriptionConfig other) { if (ReferenceEquals(null, other)) return false; if (ReferenceEquals(this, other)) return true; return Equals(other.FileMask.ToString(), FileMask.ToString()) && Equals(other.Encoding, Encoding) && Equals(other.Id, Id) && Equals(other.ConfigFileName, ConfigFileName) && other.LogDirectories.Count == LogDirectories.Count && other.LogDirectories.All(dir => LogDirectories.Contains(dir)); }
private static LogDescriptionConfig CreateLogDescription(string fullPath) { LogDescriptionConfig logDescriptionConfig = null; try { FileInfo fileInfo = new FileInfo(fullPath); logDescriptionConfig = new LogDescriptionConfig(fileInfo.FullName); } catch (Exception ex) { _logger.Error("Cannot create LogDescription from config file " + fullPath + ": " + ex); } return logDescriptionConfig; }
private static LogDescriptionConfig CreateLogDescription(string fullPath) { LogDescriptionConfig logDescriptionConfig = null; try { FileInfo fileInfo = new FileInfo(fullPath); logDescriptionConfig = new LogDescriptionConfig(fileInfo.FullName); } catch (Exception ex) { _logger.Error("Cannot create LogDescription from config file " + fullPath + ": " + ex); } return(logDescriptionConfig); }
public bool Equals(LogDescriptionConfig other) { if (ReferenceEquals(null, other)) { return(false); } if (ReferenceEquals(this, other)) { return(true); } return(Equals(other.FileMask.ToString(), FileMask.ToString()) && Equals(other.Encoding, Encoding) && Equals(other.Id, Id) && Equals(other.ConfigFileName, ConfigFileName) && other.LogDirectories.Count == LogDirectories.Count && other.LogDirectories.All(dir => LogDirectories.Contains(dir))); }
private void AddLogDescription(string fullPath, LogDescriptionConfig logDescriptionConfig) { if (logDescriptionConfig == null) return; _rwLocker.EnterWriteLock(); try { if (_logDescriptions.ContainsKey(fullPath)) { _logger.Warn(String.Format("LogDescription from file {0} already added. Recreating it.", fullPath)); return; } _logDescriptions.Add(fullPath, logDescriptionConfig); logDescriptionConfig.ConfigChanged += UpdateLogDescription; logDescriptionConfig.ConfigRenamed += RenameLogDescription; logDescriptionConfig.WatchForChanges(); } finally { _rwLocker.ExitWriteLock(); } }
private void AddLogDescription(string fullPath, LogDescriptionConfig logDescriptionConfig) { if (logDescriptionConfig == null) { return; } _rwLocker.EnterWriteLock(); try { if (_logDescriptions.ContainsKey(fullPath)) { _logger.Warn(String.Format("LogDescription from file {0} already added. Recreating it.", fullPath)); return; } _logDescriptions.Add(fullPath, logDescriptionConfig); logDescriptionConfig.ConfigChanged += UpdateLogDescription; logDescriptionConfig.ConfigRenamed += RenameLogDescription; logDescriptionConfig.WatchForChanges(); } finally { _rwLocker.ExitWriteLock(); } }