Exemplo n.º 1
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="pRecord"></param>
        public void addRecord(SystemPattern pRecord)
        {
            if (String.IsNullOrEmpty(pRecord.SystemName))
            {
                throw new Exception("You didn't define a system name");
            }
            else if (String.IsNullOrEmpty(pRecord.SystemPatternString))
            {
                throw new Exception("You didn't define a system pattern");
            }

            /*
             * Throw exception if record already exists
             */
            if (cSystemPattern != null)
            {
                foreach (SystemPattern lTmp in cSystemPattern)
                {
                    if (lTmp.Equals(pRecord))
                    {
                        throw new Exception("An entry with this pattern already exists");
                    }
                }
            }

            try { Regex.Match("", pRecord.SystemPatternString); }
            catch (ArgumentException)
            {
                throw new Exception("URL pattern is invalid");
            }

            cSystemPattern.Add(pRecord);
            saveSystemRecords();
            notify();
        }
Exemplo n.º 2
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="pRecord"></param>
 public void removeRecord(SystemPattern pRecord)
 {
     cSystemPattern.Remove(pRecord);
     saveSystemRecords();
     notify();
 }