// [Fact()] public void ReadFiles() { var file = Path.GetTempFileName(); var info = new FileInfo(file); File.AppendAllLines(file, Enumerable.Range(1, 100000).Select(i => $"This is line number {i}")); var indexer = new LineIndexer(info); var items = indexer.ReadToEnd().ToArray(); var actual = File.ReadAllLines(file).ToArray(); var toRead = Enumerable.Range(0, 1000) .Select(i => items.InferPosition(i)) .ToArray(); ; var largest = toRead.Last(); var fileLength = file.Length; Console.WriteLine(); var convertedLines = info.ReadLine(toRead, (li, str) => { return str; }).ToArray(); File.Delete(file); }
//[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(); }