Пример #1
0
        public LineIndicies(int[] lines, Encoding encoding, int lineFeedSize, LineIndicies previous = null)
        {
            Encoding = encoding;
            LineFeedSize = lineFeedSize;
            if (previous == null)
            {
                Lines = lines;
                Diff = lines.Length;
                ChangedReason = LinesChangedReason.Loaded;
                TailStartsAt = lines.Length - 1;
            }
            else
            {

                //combine the 2 arrays
                var latest = new int[previous.Lines.Length + lines.Length];
                previous.Lines.CopyTo(latest, 0);
                lines.CopyTo(latest, previous.Lines.Length);

                Lines = latest;
                Diff = lines.Length;
                ChangedReason = LinesChangedReason.Tailed;
                TailStartsAt = previous.Count - 1;
            }
        }
Пример #2
0
        //[Fact()]
        public void FileWhereThereIsAProblemIndexing()
        {
            var file = Path.GetTempFileName();
            var info = new FileInfo(@"U:\Downloads\InventairePerpetuel.txt");

            var indexer = new LineIndexer(info);
            var indexed = indexer.ReadToEnd().ToArray();
            var indicies = new LineIndicies(indexed, indexer.Encoding,indexer.LineFeedSize);

            //   var tail = indicies.GetTail(new ScrollRequest(1)).ToArray();
            var tail = indicies.GetTail(new ScrollRequest(1)).ToArray();

            Console.WriteLine(indicies.Lines.Last());
            var convertedLines = info.ReadLine(tail, (li, str) =>
            {
                Console.WriteLine(li.Size);
                Console.WriteLine(str.Length);
                return str;
            }, indicies.Encoding).ToArray();
        }
Пример #3
0
 public CombinedResult(ScrollRequest scroll, LineMatches matchedLines, LineIndicies incidies)
 {
     Scroll = scroll;
     MatchedLines = matchedLines;
     Incidies = incidies;
 }