/// <summary> /// /// </summary> /// <param name="pPattern"></param> public void addRecord(ApplicationPattern pRecord) { if (String.IsNullOrEmpty(pRecord.ApplicationPatternString)) { throw new Exception("You didn't define an application pattern"); } else if (String.IsNullOrEmpty(pRecord.ApplicationName)) { throw new Exception("You didn't define a company name"); } else if (String.IsNullOrEmpty(pRecord.CompanyURL)) { throw new Exception("You didn't define a company web page"); } else { try { Regex.Match("", pRecord.ApplicationPatternString); } catch (ArgumentException lEx) { throw new Exception("URL pattern is invalid"); } } foreach (ApplicationPattern lTmp in cApplicationPatterns) { if (lTmp.Equals(pRecord)) { throw new Exception("An entry with this pattern already exists"); } } cApplicationPatterns.Add(pRecord); cInfrastructure.saveApplicationPatterns(cApplicationPatterns); notify(); }
/// <summary> /// /// </summary> /// <param name="pObj"></param> /// <returns></returns> public override bool Equals(object pObj) { bool lRetVal = false; if (pObj is ApplicationPattern) { ApplicationPattern lTmp = (ApplicationPattern)pObj; if (lTmp.ApplicationPatternString == this.ApplicationPatternString && lTmp.ApplicationName == this.ApplicationName) { lRetVal = true; } } return(lRetVal); }
/// <summary> /// /// </summary> /// <param name="pPattern"></param> public void removeRecord(ApplicationPattern pRecord) { cApplicationPatterns.Remove(pRecord); cInfrastructure.saveApplicationPatterns(cApplicationPatterns); notify(); }