BiliRanking.Core.Download.MultiThreadedWebDownloader.Pause C# (CSharp) Method

Pause() public method

Pause the download.
public Pause ( ) : void
return void
        public void Pause()
        {
            // Only downloading downloader can be paused.
            if (this.Status != DownloadStatus.Downloading)
            {
                throw new ApplicationException(
                    "Only downloading downloader can be paused.");
            }

            this.Status = DownloadStatus.Pausing;

            // Pause all the HttpDownloadClients. If all of the clients are paused,
            // the status of the downloader will be changed to Paused.
            foreach (var client in this.downloadClients)
            {
                if (client.Status == DownloadStatus.Downloading)
                {
                    client.Pause();
                }
            }
        }