Exemplo n.º 1
0
        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();
                }
            }
        }
Exemplo n.º 2
0
        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]);
            }
        }
Exemplo n.º 3
0
        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();
                }
            }
        }
Exemplo n.º 4
0
 public void Add(LogFileMonitor monitor)
 {
     // first remove the event listener just in case
     monitor.ChangedLogMessage -= NotifyLogMessage;
     monitor.ChangedLogMessage += NotifyLogMessage;
 }
Exemplo n.º 5
0
 public void Remove(LogFileMonitor monitor)
 {
     monitor.ChangedLogMessage -= NotifyLogMessage;
 }
Exemplo n.º 6
0
 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];
            }
        }
Exemplo n.º 8
0
        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;
            }
        }