Example #1
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="obj"></param>
        /// <returns></returns>
        public override bool Equals(object lObj)
        {
            bool lRetVal = false;

            if (lObj is AccountPattern)
            {
                AccountPattern lTmp = (AccountPattern)lObj;

                if (lTmp.Method == this.Method && lTmp.Host == this.Host && lTmp.Path == this.Path)
                {
                    lRetVal = true;
                } // if (lObj...
            }     // if (lObj...

            return(lRetVal);
        }
Example #2
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="pRecord"></param>
        public void addRecord(AccountPattern pRecord)
        {
            if (pRecord == null)
            throw new Exception("Something is wrong with the account pattern record.");
              else if (pRecord.Method == null || pRecord.Method.Length <= 0)
            throw new Exception("You didn't define a request method");
              else if (pRecord.Host == null || pRecord.Host.Length <= 0)
            throw new Exception("You didn't define a host pattern");
              else if (pRecord.Path == null || pRecord.Path.Length <= 0)
            throw new Exception("You didn't define a path pattern");
              else if (pRecord.DataPattern == null || pRecord.DataPattern.Length <= 0)
            throw new Exception("You didn't define a data pattern");
              else if (pRecord.Company == null || pRecord.Company.Length <= 0)
            throw new Exception("You didn't define a company name");
              else if (pRecord.WebPage == null || pRecord.WebPage.Length <= 0)
            throw new Exception("You didn't define a company web page");
              else
              {
            try { Regex.Match("", pRecord.Host); }
            catch (ArgumentException)
            {
              throw new Exception("Host pattern is invalid");
            }

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

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

              if (cAccountPatterns.Count > 0)
            foreach (AccountPattern lTmp in cAccountPatterns)
              if (lTmp.Equals(pRecord))
            throw new Exception("This record already exists.");

              cAccountPatterns.Add(pRecord);
              notify();
        }
Example #3
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="pRecord"></param>
        public void addRecord(AccountPattern pRecord)
        {
            if (pRecord == null)
            {
                throw new Exception("Something is wrong with the account pattern record.");
            }
            else if (pRecord.Method == null || pRecord.Method.Length <= 0)
            {
                throw new Exception("You didn't define a request method");
            }
            else if (pRecord.Host == null || pRecord.Host.Length <= 0)
            {
                throw new Exception("You didn't define a host pattern");
            }
            else if (pRecord.Path == null || pRecord.Path.Length <= 0)
            {
                throw new Exception("You didn't define a path pattern");
            }
            else if (pRecord.DataPattern == null || pRecord.DataPattern.Length <= 0)
            {
                throw new Exception("You didn't define a data pattern");
            }
            else if (pRecord.Company == null || pRecord.Company.Length <= 0)
            {
                throw new Exception("You didn't define a company name");
            }
            else if (pRecord.WebPage == null || pRecord.WebPage.Length <= 0)
            {
                throw new Exception("You didn't define a company web page");
            }
            else
            {
                try { Regex.Match("", pRecord.Host); }
                catch (ArgumentException)
                {
                    throw new Exception("Host pattern is invalid");
                }

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

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

            if (cAccountPatterns.Count > 0)
            {
                foreach (AccountPattern lTmp in cAccountPatterns)
                {
                    if (lTmp.Equals(pRecord))
                    {
                        throw new Exception("This record already exists.");
                    }
                }
            }

            cAccountPatterns.Add(pRecord);
            notify();
        }
Example #4
0
 /// <summary>
 /// 
 /// </summary>
 /// <param name="pRecord"></param>
 public void removeRecord(AccountPattern pRecord)
 {
     cAccountPatterns.Remove(pRecord);
       notify();
 }
Example #5
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="pRecord"></param>
 public void removeRecord(AccountPattern pRecord)
 {
     cAccountPatterns.Remove(pRecord);
     notify();
 }