コード例 #1
0
ファイル: TaskFacade.cs プロジェクト: vaginessa/Simsang
        /// <summary>
        /// 
        /// </summary>
        /// <param name="pPattern"></param>
        public void addRecord(SessionPattern pRecord)
        {
            if (pRecord == null)
            throw new Exception("Something is wrong with the record");
              else if (String.IsNullOrEmpty(pRecord.SessionName))
            throw new Exception("You didn't define a session name");
              else if (String.IsNullOrEmpty(pRecord.HTTPHost))
            throw new Exception("You didn't define a HTTP Host regex");
              else if (String.IsNullOrEmpty(pRecord.Webpage))
            throw new Exception("You didn't define a company web page");
              else if (String.IsNullOrEmpty(pRecord.SessionPatternString))
            throw new Exception("You didn't define a session cookie regex");

              /*
               * Check Host and Cookie regex
               */
              try
              {
            new Regex(@pRecord.SessionPatternString);
              }
              catch (ArgumentException)
              {
            throw new Exception("Session cookies regex is invalid");
              }

              foreach (SessionPattern lTmp in cSessionPatterns)
            if (lTmp.Equals(pRecord))
              throw new Exception("This record already exists");

              cSessionPatterns.Add(pRecord);
              saveSessionPatterns();
              notify();
        }
コード例 #2
0
ファイル: SessionPattern.cs プロジェクト: xzblueidea/Simsang
        /// <summary>
        ///
        /// </summary>
        /// <param name="obj"></param>
        /// <returns></returns>
        public override bool Equals(object pObj)
        {
            bool lRetVal = false;

            if (pObj is SessionPattern)
            {
                SessionPattern lTmp = (SessionPattern)pObj;

                if (lTmp.cSessionPatternString == this.cSessionPatternString && lTmp.cHTTPHost == this.cHTTPHost)
                {
                    lRetVal = true;
                }
            }

            return(lRetVal);
        }
コード例 #3
0
ファイル: TaskFacade.cs プロジェクト: vaginessa/Simsang
 /// <summary>
 /// 
 /// </summary>
 /// <param name="pPattern"></param>
 public void removeRecord(SessionPattern pRecord)
 {
     cSessionPatterns.Remove(pRecord);
       saveSessionPatterns();
       notify();
 }