예제 #1
0
        private void NewChatLines(object sender, LogFile.EveChatEventArgs e)
        {
            LogFile curLog = (LogFile)sender;

            // check for channel ignore list
            if (IsIgnoredChannel(curLog))
            {
                return;
            }

            string logLines = e.NewLogLines;

            // check log lines - line for line
            StringReader sr = new StringReader(logLines);

            string curLine = null;

            while ((curLine = sr.ReadLine()) != null)
            {
                curLine = curLine.Trim();

                LogEntry le = LogReader.GetLogEntry(curLine);

                if (Properties.Settings.Default.LogAllMessages)
                {
                    Logging.WriteLine(string.Format("{3}: Message from '{0}' in '{1}': {2}", le.Sender, curLog.LogInfo.ChannelName, le.Text, curLog.LogInfo.PilotName));
                }

                // unable to read sender - but we need it so do nothing
                if (string.IsNullOrWhiteSpace(le.Sender))
                {
                    continue;
                }

                // check if sender is current user (ignore if user wants to ignore this messages)
                if (Properties.Settings.Default.IgnoreOwnMessages && le.Sender.Equals(curLog.LogInfo.PilotName, StringComparison.OrdinalIgnoreCase))
                {
                    continue;
                }
                // check if sender is "EVE-System" to prevent MOTD notifications
                if (Properties.Settings.Default.IgnoreMotd && le.Sender.Equals(Properties.Settings.Default.MotdUsername.Trim(), StringComparison.OrdinalIgnoreCase))
                {
                    continue;
                }
                // check if the sender is on the ignore list
                if (IsIgnoredPilot(le))
                {
                    continue;
                }
                bool needsNotify = false;
                // check if sender or channel is in always list
                if (IsAlwaysPilot(le) || IsAlwaysChannel(curLog))
                {
                    needsNotify = true;
                }
                // check if notification is needed
                if (le.Text.ToLower().Contains(curLog.LogInfo.PilotName.ToLower()))
                {
                    needsNotify = true;
                }
                if (!string.IsNullOrWhiteSpace(Properties.Settings.Default.NotifyKeywords))
                {
                    string[] alsoCheck = Properties.Settings.Default.NotifyKeywords.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries);
                    foreach (string toCheck in alsoCheck)
                    {
                        if (le.Text.ToLower().Contains(toCheck.Trim().ToLower()))
                        {
                            needsNotify = true;
                            break;
                        }
                    }
                }

                // if notification is needed
                if (needsNotify) // isPlaying is managing the notification using sound (only one at a time)
                {
                    Logging.WriteLine(string.Format("{3}: Notify for chat message of '{0}' in '{1}': {2}", le.Sender, curLog.LogInfo.ChannelName, le.Text, curLog.LogInfo.PilotName));
                    Notifier.GetInstance().Notify(string.Format("{0} in '{1}'", le.Sender, curLog.LogInfo.ChannelName), le.Text, PathHelper.DecryptPath(Properties.Settings.Default.SoundFilePath));
                }
            }
        }
예제 #2
0
 private void CmCheckUpdate_Click(object sender, EventArgs e)
 {
     Notifier.GetInstance().Notify("Update check", "Checking for update - if there is a new version you get a new window appears leading your throught the update process.");
     CheckForUpdate();
 }