Beispiel #1
0
        /// <summary>
        /// This function adds a new entry to the dictionary
        /// The return value indicates if the add was successful.
        /// If the add failed the value "LastException" stores the exception which had been occurred.
        /// </summary>
        /// <param name="name">Name of the regex expression. This name will be used for creating the result dictionary</param>
        /// <param name="regexElement">RegexElement with the regex search string and with the optional regex options</param>
        /// <returns>Flag if the add was successful </returns>
        /// true  = successful
        /// false = failed
        // ReSharper disable once UnusedMember.Global
        public bool Add(string name, RegexElement regexElement)
        {
            try
            {
                RegexListDictionary.Add(name, regexElement);

                return(true);
            }
            catch (Exception ex)
            {
                LastException = ex;
                return(false);
            }
        }
Beispiel #2
0
        /// <summary>
        /// Constructor for building a RegExList instance
        /// </summary>
        /// <param name="name">Name of the regex. This name will be used for creating the result dictionary</param>
        /// <param name="regexElement">RegexElement with the regex search string and with the optional regex options</param>
        // ReSharper disable once UnusedMember.Global
        public RegExList(string name, RegexElement regexElement)
        {
            try
            {
                RegexListDictionary = new Dictionary <string, RegexElement>
                {
                    { name, regexElement }
                };

                LastException = null;
            }
            catch (Exception ex)
            {
                RegexListDictionary = null;
                LastException       = ex;
            }
        }