private void DownloadFile(FileLink fileLink, WebClient client) { Console.WriteLine("File {0} status - started.", fileLink.Name); var sppedInBps = _speedInKbps * 1024; _timer.Start(); using (var stream = client.OpenRead(fileLink.HttpAddress)) { var throttledStream = new ThrottledStream(stream, sppedInBps); var fileName = _outputPath + fileLink.Name; using (var file = File.Create(fileName)) { var buffer = new byte[BufferSize]; var readCount = throttledStream.Read(buffer, 0, BufferSize); while (readCount > 0) { file.Write(buffer, 0, readCount); readCount = throttledStream.Read(buffer, 0, BufferSize); } } throttledStream.Close(); } _timer.Stop(); Console.WriteLine("File {0} status - downloaded in {1} seconds.", fileLink.Name, _timer.ElapsedMilliseconds / 1000); _timer.Reset(); }