public void Remove(LogFileMonitor monitor) { if (monitor != null) { if (monitors.Remove(monitor)) { monitor.ChangedLogMessage -= SetLogMessage; monitor.ChangedLogChannel -= SetLogChannel; } if (monitors.Count == 0 && refreshTimer.Enabled) { Stop(); } } }
private LogFileMonitor GetFileItem(string FullPath) { FileInfo fileInfo = new FileInfo(FullPath); LogFileMonitor monitor; lock (fileSteams) { if (fileSteams.ContainsKey(FullPath)) { monitor = fileSteams[FullPath]; } else { fileSteams[FullPath] = new LogFileMonitor(fileInfo); } return(fileSteams[FullPath]); } }
public void Add(LogFileMonitor monitor) { if (monitor != null) { monitors.Add(monitor); monitor.ChangedLogMessage += SetLogMessage; monitor.ChangedLogChannel += SetLogChannel; FileChannel fileChannel = monitor.FileChannel; SetLogChannel(fileChannel.Channel); if (!refreshTimer.Enabled) { Start(); } } }
public void Add(LogFileMonitor monitor) { // first remove the event listener just in case monitor.ChangedLogMessage -= NotifyLogMessage; monitor.ChangedLogMessage += NotifyLogMessage; }
public void Remove(LogFileMonitor monitor) { monitor.ChangedLogMessage -= NotifyLogMessage; }
private void OnChanged(object source, FileSystemEventArgs e) { LogFileMonitor monitor = GetFileItem(e.FullPath); }
private LogFileMonitor GetFileItem(string FullPath) { FileInfo fileInfo = new FileInfo(FullPath); LogFileMonitor monitor; lock (fileSteams) { if (fileSteams.ContainsKey(FullPath)) { monitor = fileSteams[FullPath]; } else { fileSteams[FullPath] = new LogFileMonitor(fileInfo); } return fileSteams[FullPath]; } }
private bool LoadLogFileMonitor(LogFileMonitor monitor) { if (!listLoadedChannels.Items.Contains(monitor)) { logReaderUI.Add(monitor); listLoadedChannels.Items.Add(monitor); Analyzer.Add(monitor); return true; } else { return false; } }