Ejemplo n.º 1
0
        private void updateFileData(FileChannel item)
        {
            bool isNew = (item.Channel.ChannelID == null);

            string[] lines = item.ReadLastBlock();

            if (isNew && item.Channel.ChannelID != null)
            {
                if (ChangedLogChannel != null)
                {
                    ChangedLogChannel(item.Channel);
                }
            }

            if (lines != null)
            {
                foreach (string line in lines)
                {
                    // ((FileChannel)item).LogCannel
                    if (LogMessage.isValidMessage(line))
                    {
                        LogMessage message = new LogMessage(item.Channel, line);
                        if (ChangedLogMessage != null)
                        {
                            ChangedLogMessage(message);
                        }
                    }
                }
            }
        }
Ejemplo n.º 2
0
 public LogFileMonitor(FileInfo file)
 {
     this.fileChannel   = new FileChannel(file);
     watch.NotifyFilter = NotifyFilters.LastWrite | NotifyFilters.FileName;
     watch.Filter       = file.Name;
     watch.Changed     += new FileSystemEventHandler(OnChanged);
     watch.Created     += new FileSystemEventHandler(OnChanged);
 }