Пример #1
0
        private void SplitData(ISortStrategy sortStrategy, DataRecordReader reader, long fileLength)
        {
            var timer = Stopwatch.StartNew();

            var readerPositionPrev = 0L;

            foreach (var dataRecord in reader)
            {
                var readerPosition = reader.Position;
                if (readerPosition - readerPositionPrev > Constants.HundredMegabytes)
                {
                    ShowProgress(readerPosition, fileLength, timer.Elapsed.TotalSeconds);
                    readerPositionPrev = readerPosition;
                }

                sortStrategy.Aggregate(dataRecord);
            }

            ShowProgress(reader.Position, fileLength, timer.Elapsed.TotalSeconds);

            Console.WriteLine();
            Console.WriteLine($"Splitting executed at {timer.Elapsed}");
        }