示例#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();
                }
            }
        }
示例#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]);
            }
        }
示例#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();
                }
            }
        }
示例#4
0
 public void Add(LogFileMonitor monitor)
 {
     // first remove the event listener just in case
     monitor.ChangedLogMessage -= NotifyLogMessage;
     monitor.ChangedLogMessage += NotifyLogMessage;
 }
示例#5
0
 public void Remove(LogFileMonitor monitor)
 {
     monitor.ChangedLogMessage -= NotifyLogMessage;
 }
示例#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];
            }
        }
示例#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;
            }
        }