private void GenerateLines(
            int worker,
            int bufferSize,
            long bytesRequired,
            int percentOfAppearance
            )
        {
            int progress;

            using (var ms = new MemoryStream())
                using (var sw = new StreamWriter(ms))
                {
                    sw.AutoFlush = true;

                    while (_bytesWritten < bytesRequired)
                    {
                        if (ms.Length < bufferSize)
                        {
                            sw.Write(_lineGenerator.Generate(percentOfAppearance, bytesRequired));
                        }
                        else
                        {
                            lock (FILE)
                            {
                                ms.Position = 0;
                                _fileWriter.CopyFrom(ms);
                            }

                            _bytesWritten += ms.Length;

                            ms.SetLength(0);

                            if (_progress != null)
                            {
                                progress = (int)(_bytesWritten * 100 / bytesRequired);

                                if (progress > 100)
                                {
                                    progress = 100;
                                }

                                _progress.Report(progress);
                            }
                        }
                    }
                }
        }