コード例 #1
0
        private static object[] GetAlertRow(Alert alert)
        {
            object[] row = new object[3];
            row[0] = alert.violator;
            row[1] = alert.priority.ToString() + " - " + Rule.PriorityToString(alert.priority);
            row[2] = alert;

            return row;
        }
コード例 #2
0
        /// <summary>
        /// Adds an alert to this server.  Only one alert with the same violated rule and culprit session is allowed
        /// </summary>
        /// <param name="alert">The alert to attemtp to add</param>
        public void AddAlert(Alert alert)
        {
            Alert existing = alerts.Find(a => a.rule.ToString().Equals(alert.rule.ToString()) && a.violator.Equals(alert.violator));

            if (existing == null)
            {
                int index = alerts.FindLastIndex(a => a.priority == alert.priority - 1);
                alerts.Insert(index+1, alert);
                alert.SetServer(this);
            }
            else
                foreach (DataRow row in alert.table.Rows)
                    existing.AddRow(row);
        }