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); } } } } }
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); }