Exemplo n.º 1
0
        private int CalculateBlockSize(
            string inputPath,
            long blockSize
            )
        {
            try
            {
                _fileReader.BeginRead(inputPath, 1024);

                var linesNumber     = 1000;
                var lines           = _fileReader.ReadLines(linesNumber).ToArray();
                var averageLineSize = lines.Sum(x => x.Length + Environment.NewLine.Length) / lines.Count();

                return((int)(blockSize / averageLineSize) + 1);
            }
            finally
            {
                _fileReader.EndRead();
            }
        }