File Resume when downloading file

Sep 14, 2015 at 1:33 PM
I am using following code for downloading file.
How can i add file resume funtionality in it ?
 string strRemoteFilePath = _appSettings["SFTP_IncomingFileFolder"] + file.Folder + @"/" + file.FileName;
                        string strLocalFilePath = _appSettings["Local_IncomingFileFolder"] + file.Folder + @"\" + file.FileName;

                        Logger.Log(String.Format("Downloading Start File Name = {0}, FolderName= {1}", file.FileName, file.Folder), EnumLogTypes.Debug);
                        using (var writeStream = new FileStream(strLocalFilePath, FileMode.Create))
                        {
                            using (Stream downloadStream = session.OpenRead(strRemoteFilePath))
                            {
                                const int bufLen = 32768;
                                var buffer = new byte[bufLen];
                                int bytesRead = downloadStream.Read(buffer, 0, bufLen);
                                while (bytesRead > 0)
                                {
                                    writeStream.Write(buffer, 0, bytesRead);
                                    //_logger.Info("Write bytes:{0:D6}", bytesRead);
                                    bytesRead = downloadStream.Read(buffer, 0, bufLen);
                                    if (bytesRead == 0) break;
                                    //totalRead += bytesRead;
                                    //_logger.Info("Read: {0:D6} bytes Total:{1:D10}", bytesRead, totalRead);
                                }

                            }
                        }