Exemple #1
0
        //check to see if theres a more up-to-date version of any channel
        private void refreshChannels()
        {
            LogDirectoryMonitor l = new LogDirectoryMonitor(IntelProperties.EXPIRY);

            l.Path = IntelProperties.getProperty("LOG_DIR");

            List <LogFileMonitor> monitors = l.ReadDirectory();

            foreach (LogFileMonitor m in monitors)
            {
                m.Refresh(true);
                string name = m.FileChannel.Channel.ChannelName;

                //if this channel is already being monitored, check to make sure the files are the same
                if (monitoredChannels.Contains(name) && channels.ContainsKey(name))
                {
                    Monitor om = channels[name];
                    if (om.logMonitor.FileChannel.File.Name != m.FileChannel.File.Name && om.logMonitor.FileChannel.File.LastWriteTime < m.FileChannel.File.LastWriteTime)
                    {
                        Console.WriteLine("Updating file " + m.FileChannel.File.Name);
                        channels.Remove(name);
                        channels.Add(name, new Monitor(m));
                    }
                }
                else if (monitoredChannels.Contains(name) && !channels.ContainsKey(name))
                {
                    //else, just add a new monitor
                    Console.WriteLine("Monitoring " + name);
                    channels.Add(name, new Monitor(m));
                }
            }
        }
Exemple #2
0
        private void initChannels()
        {
            LogDirectoryMonitor l = new LogDirectoryMonitor(IntelProperties.EXPIRY);
            l.Path = IntelProperties.getProperty("LOG_DIR");

            List<LogFileMonitor> monitors = l.ReadDirectory();
            foreach (LogFileMonitor m in monitors)
            {
                m.Refresh(true);
                string name = m.FileChannel.Channel.ChannelName;
                if (monitoredChannels.Contains(name))
                {
                    Console.WriteLine("Monitoring "+name);
                    channels.Add(name, new Monitor(m));
                }
            }
        }
Exemple #3
0
        private void initChannels()
        {
            LogDirectoryMonitor l = new LogDirectoryMonitor(IntelProperties.EXPIRY);

            l.Path = IntelProperties.getProperty("LOG_DIR");

            List <LogFileMonitor> monitors = l.ReadDirectory();

            foreach (LogFileMonitor m in monitors)
            {
                m.Refresh(true);
                string name = m.FileChannel.Channel.ChannelName;
                if (monitoredChannels.Contains(name))
                {
                    Console.WriteLine("Monitoring " + name);
                    channels.Add(name, new Monitor(m));
                }
            }
        }
Exemple #4
0
        //check to see if theres a more up-to-date version of any channel
        private void refreshChannels()
        {
            LogDirectoryMonitor l = new LogDirectoryMonitor(IntelProperties.EXPIRY);
            l.Path = IntelProperties.getProperty("LOG_DIR");

            List<LogFileMonitor> monitors = l.ReadDirectory();
            foreach (LogFileMonitor m in monitors)
            {
                m.Refresh(true);
                string name = m.FileChannel.Channel.ChannelName;

                //if this channel is already being monitored, check to make sure the files are the same
                if (monitoredChannels.Contains(name) && channels.ContainsKey(name))
                {
                    Monitor om = channels[name];
                    if (om.logMonitor.FileChannel.File.Name != m.FileChannel.File.Name && om.logMonitor.FileChannel.File.LastWriteTime < m.FileChannel.File.LastWriteTime)
                    {
                        Console.WriteLine("Updating file "+m.FileChannel.File.Name);
                        channels.Remove(name);
                        channels.Add(name, new Monitor(m));
                    }
                }
                else if (monitoredChannels.Contains(name) && !channels.ContainsKey(name))
                {
                    //else, just add a new monitor
                    Console.WriteLine("Monitoring " + name);
                    channels.Add(name, new Monitor(m));
                }
            }
        }