Exemplo n.º 1
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="pRecord"></param>
        public void addRecord(Session.Config.Session pRecord)
        {
            Int32 lDstPort = 0;

            if (pRecord != null)
            {
                // Check if record already exists
                foreach (Session.Config.Session lTmp in cRecordList)
                {
                    if (lTmp.ID == pRecord.ID)
                    {
                        throw new Exception("Session alrady exists.");
                    }
                }

                // Check if URL is correct
                if (!Regex.Match(pRecord.URL, @"[\w\d\-_\.:/]+/.+").Success)
                {
                    throw new Exception("Something is wrong with the URL.");
                }

                // Check if destination port is correct
                if (!Int32.TryParse(pRecord.DstPort, out lDstPort))
                {
                    throw new Exception("Something is wrong with the destination port.");
                }

                cRecordList.Add(pRecord);

                // Resize the DGV to the defined maximum size. \
                while (cRecordList.Count > cMaxTableRows)
                {
                    cRecordList.RemoveAt(0);
                }

                notify();
            }
        }
Exemplo n.º 2
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="pRecord"></param>
 public void addRecord(Session.Config.Session pRecord)
 {
     cDomain.addRecord(pRecord);
 }