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

Cancel() public method

Cancel the download
public Cancel ( ) : void
return void
        public void Cancel()
        {
            if (this.Status == DownloadStatus.Initialized
                || this.Status == DownloadStatus.Waiting
                || this.Status == DownloadStatus.Completed
                || this.Status == DownloadStatus.Paused
                || this.Status == DownloadStatus.Canceled)
            {
                this.Status = DownloadStatus.Canceled;
            }
            else if (this.Status == DownloadStatus.Canceling
                || this.Status == DownloadStatus.Pausing
                || this.Status == DownloadStatus.Downloading)
            {
                this.Status = DownloadStatus.Canceling;
            }

            // Cancel all HttpDownloadClients.
            foreach (var client in this.downloadClients)
            {
                client.Cancel();
            }
        }