Exemplo n.º 1
0
        private void parseLine(string line, int lineIndex)
        {
            bool removed = !LineFilter.filter(line, Filters);

            if (!removed)
            {
                matchAddLine(line, lineIndex);
            }
        }
 public void Basic_Filter_Test()
 {
     string[] lines =
     {
         "Abc",
         "Heis",
         "Ab",
         "Hei"
     };
     var lf = new LineFilter();
     var prefixSpecification = new StartWithSpecification("He");
     var result = lf.Filter(lines, prefixSpecification);
     result.Count().Should().Be(2);
 }
Exemplo n.º 3
0
        public void Execute()
        {
            var options = Options as SearchOptions;

            try
            {
                Parallel.For(0, Stats.TotalFiles, fileIndex =>
                {
                    {
                        var filename       = Files[fileIndex];
                        var sourceLines    = File.ReadAllLines(filename);
                        string filenameExt = Path.GetExtension(filename).ToLower();
                        Stats.FoundFiles++;
                        var foundInFile = FileFilter.Match(options, filename, filenameExt);
                        for (var lineNo = 0; lineNo < sourceLines.Length; lineNo++)
                        {
                            var line  = sourceLines[lineNo];
                            var lines = LineFilter.Match(options, Files[fileIndex], filenameExt, sourceLines, sourceLines[lineNo] + " ", lineNo);
                            if (lines.Count() > 0 && foundInFile)
                            {
                                foreach (var processedLine in lines)
                                {
                                    foundLines.Add(processedLine);
                                }
                            }
                        }
                    }
                });
            }
            finally
            {
                foundLines.CompleteAdding();
            }

            var result = foundLines.GetConsumingEnumerable().ToList();

            if (result.Any())
            {
                ProcessHtmlOutput(Options as SearchOptions, result);
                ProcessConsoleOutput(Options as SearchOptions, result);
                ProcessFileUpdateRelatedDirectives(Options as SearchOptions, result);
            }
        }
Exemplo n.º 4
0
    private void BuildMesh(List <Vector2> points)
    {
        _lastCreatedObject = null;

        Vector2[] temp = new Vector2[points.Count];
        points.CopyTo(temp);
        _points = new List <Vector2>(temp);

        if (_points.Count < MINIMUM_ALLOWED_VERTICES)
        {
            InvalidShapeCreated();
            return;
        }

        if (_filter)
        {
            _points = LineFilter.Filter(_points);
        }

        ConstructPolygon();
    }
Exemplo n.º 5
0
        public void propagateToBackingFilters(MyBindingList <LineFilter> filters)
        {
            if (backingFilter == null)
            {
                // if new filter was removed before being applied
                if (removed)
                {
                    return;
                }

                // if filter is new
                switch (type)
                {
                case LineFilterType.MatchesRegex:
                    backingFilter = new MatchesRegexFilter();
                    break;

                case LineFilterType.StartsWith:
                    backingFilter = new StartsWithFilter();
                    break;
                }
                backingFilter.Pattern = FilterPattern;
                filters.Add(backingFilter);
            }
            else
            {
                if (removed)
                {
                    // if existing filter is removed
                    filters.Remove(backingFilter);
                }
                else
                {
                    // if existing filter was changed
                    backingFilter.Pattern = FilterPattern;
                }
            }
        }
 public async Task <IActionResult> Search([FromQuery] LineFilter filter)
 {
     return(Ok(await lineService.QueryWithPage(filter)));
 }