Пример #1
0
        public ColRegExpProcessor(int id, int columnID, string regExp, bool build, string extract, int score, int factor, string prefixMatch, string suffixMatch, int color, string lookAhead, string lookBehind, string negLookAhead, string negLookBehind, string exceptions, bool ignoreCase, bool compiled)
            : this(null)
        {
            _listRegExps.Add(new ColRegExp(RegExpOptions.CreateOptions(ignoreCase, compiled), id, columnID, regExp, build, extract, score, factor, prefixMatch, suffixMatch, color, lookAhead, lookBehind, negLookAhead, negLookBehind, exceptions, String.Empty));

            _hasEmptyItems = Sanitize();
        }
Пример #2
0
        public ColRegExpProcessor(string regExpDatabasePath, string password, int regExpID, bool ignoreCase = true, bool compiled = false)
            : this(null)
        {
            _password = password;

            using (var connection = DatabaseHelper.CreateConnection(regExpDatabasePath, password))
            {
                var options = RegExpOptions.CreateOptions(ignoreCase, compiled);

                ///////////////////////////////////////////////////////////////////////////////

                var query = "SELECT ID, ColumnID, RegExp, [Extract], [RegExpColor], [lookahead], [lookbehind], [neg lookahead], [neg lookbehind], [exceptions] FROM ColRegExp WHERE ID = " + regExpID;

                var regExpRows = DatabaseHelper.GetDataRows(connection, query).ToList();
                if (!regExpRows.Any())
                {
                    throw new Exception("Invalid RegExpID");
                }

                var regExp = RegExpFactory.Create_ColRegExp(regExpRows.First(), null, true, options);
                _listRegExps.Add(regExp);

                ///////////////////////////////////////////////////////////////////////////////

                _hasEmptyItems = Sanitize();
            }
        }
Пример #3
0
        public RegExpProcessor(Logger logger, string regExpDatabasePath, string password, bool ignoreCase = true, bool compiled = false)
            : this(logger)
        {
            using (var connection = DatabaseHelper.CreateConnection(regExpDatabasePath, password))
            {
                var options = RegExpOptions.CreateOptions(ignoreCase, compiled);

                ///////////////////////////////////////////////////////////////////////////////

                var query = "SELECT ID, RegExp, score, [Arithmetic factor], [prefix match], [suffix match], [RegExpColor], [lookahead], [lookbehind], [neg lookahead], [neg lookbehind], [exceptions], [categoryID] FROM RegExp";

                var regExpRows = DatabaseHelper.GetDataRows(connection, query);

                foreach (var row in regExpRows)
                {
                    try
                    {
                        var regExp = RegExpFactory.Create_RegExp(row, true, options);
                        if (regExp != null)
                        {
                            _listRegExps.Add(regExp);
                        }
                    }
                    catch
                    {
                        this.Logger.HandleRegExpException(row);
                    }
                }

                _hasEmptyItems = Sanitize();
            }
        }
Пример #4
0
        public ColRegExpProcessor(DataRow row, IEnumerable <int> columnIDs, bool ignoreCase = true, bool compiled = false)
            : this(null)
        {
            var regExp = RegExpFactory.Create_ColRegExp(row, columnIDs, true, RegExpOptions.CreateOptions(ignoreCase, compiled));
            if (regExp == null)
            {
                throw new DataException("Row is deleted or detached");
            }

            _listRegExps.Add(regExp);

            _hasEmptyItems = Sanitize();
        }
Пример #5
0
        public RegExpProcessor(Logger logger, object id, string regExp, object score, object factor, string prefixMatch, string suffixMatch, object color, string lookAhead, string lookBehind, string negLookAhead, string negLookBehind, string exceptions, object categoryID, bool ignoreCase, bool compiled)
            : this(logger)
        {
            try
            {
                _listRegExps.Add(new RegExp(RegExpOptions.CreateOptions(ignoreCase, compiled), id, regExp, true, score, factor, prefixMatch, suffixMatch, color, lookAhead, lookBehind, negLookAhead, negLookBehind, exceptions, String.Empty, categoryID));
            }
            catch
            {
                this.Logger.HandleRegExpException(regExp);
            }

            _hasEmptyItems = Sanitize();
        }
Пример #6
0
        public RegExpProcessor(IEnumerable <DataRow> regExpRows, bool ignoreCase = true, bool compiled = false)
            : this(null)
        {
            var options = RegExpOptions.CreateOptions(ignoreCase, compiled);

            ///////////////////////////////////////////////////////////////////////////////

            foreach (var row in regExpRows)
            {
                var regExp = RegExpFactory.Create_RegExp(row, true, options);
                if (regExp != null)
                {
                    _listRegExps.Add(regExp);
                }
            }

            _hasEmptyItems = Sanitize();
        }
Пример #7
0
        public ColRegExpProcessor(IEnumerable <DataRow> enumerable, IEnumerable <int> columnIDs, bool ignoreCase = true, bool compiled = false)
            : this(null)
        {
            var options = RegExpOptions.CreateOptions(ignoreCase, compiled);

            ///////////////////////////////////////////////////////////////////////////////

            foreach (var row in enumerable)
            {
                var regExp = RegExpFactory.Create_ColRegExp(row, columnIDs, true, options);
                if (regExp != null)
                {
                    _listRegExps.Add(regExp);
                }
            }

            _listRegExps = _listRegExps.OrderBy(x => x.ExtractOptions != null ? x.ExtractOptions.Order : 0)
                           .ToList();

            _hasEmptyItems = Sanitize();
        }
Пример #8
0
        public ColRegExpProcessor(Logger logger, string regExpDatabasePath, string password, IEnumerable <int> columnIDs, bool ignoreCase = true, bool compiled = false)
            : this(logger)
        {
            using (var connection = DatabaseHelper.CreateConnection(regExpDatabasePath, password))
            {
                var options = RegExpOptions.CreateOptions(ignoreCase, compiled);

                ///////////////////////////////////////////////////////////////////////////////

                var query = "SELECT ID, ColumnID, RegExp, [Extract], [RegExpColor], [lookahead], [lookbehind], [neg lookahead], [neg lookbehind], [exceptions] FROM ColRegExp";

                var regExpRows = DatabaseHelper.GetDataRows(connection, query);

                foreach (var row in regExpRows)
                {
                    try
                    {
                        var regExp = RegExpFactory.Create_ColRegExp(row, columnIDs, true, options);
                        if (regExp != null)
                        {
                            _listRegExps.Add(regExp);
                        }
                    }
                    catch
                    {
                        this.Logger.HandleRegExpException(row);
                    }
                }

                ///////////////////////////////////////////////////////////////////////////////

                _listRegExps = _listRegExps.OrderBy(x => x.ExtractOptions != null ? x.ExtractOptions.Order : 0)
                               .ToList();

                _hasEmptyItems = Sanitize();
            }
        }
Пример #9
0
 public static ColRegExp Create_ColRegExp(DataRow row, IEnumerable <int> columnIDs, bool build, bool ignoreCase = true, bool compiled = false)
 {
     return(Create_ColRegExp(row, columnIDs, build, RegExpOptions.CreateOptions(ignoreCase, compiled)));
 }
Пример #10
0
 public static RegExp Create_RegExp(DataRow row, bool build, bool ignoreCase = true, bool compiled = false)
 {
     return(Create_RegExp(row, build, RegExpOptions.CreateOptions(ignoreCase, compiled)));
 }