コード例 #1
0
ファイル: LogFileMonitor.cs プロジェクト: FCCGit/IntelClient
        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);
                        }
                    }
                }
            }
        }
コード例 #2
0
ファイル: IntelMonitor.cs プロジェクト: FCCGit/IntelClient
        private void parse(LogMessage message)
        {
            //ignore the MOTD
            if (message.Message.StartsWith("Channel MOTD"))
            {
                return;
            }

            //check the timestamp, make sure this is relevant
            TimeSpan diff = getDiff(DateTime.UtcNow, message.Timestamp);
            if (diff.TotalMinutes > IntelProperties.EXPIRY)
            {
                return;
            }

            Console.WriteLine(message);
            Report.reportViaHTTP(channel+": "+message.Name+"["+message.Timestamp.ToString()+"]: "+message.Message);
        }