BiliRanking.Core.Download.HttpDownloadClient.Download C# (CSharp) Метод

Download() публичный Метод

Start to download.
public Download ( ) : void
Результат void
        public void Download()
        {
            // Only idle download client can be started.
            if (this.Status != DownloadStatus.Initialized)
            {
                throw new ApplicationException("Only Initialized download client can be started.");
            }

            this.Status = DownloadStatus.Waiting;

            // Start to download in the same thread.
            DownloadInternal(null);
        }

Usage Example

Пример #1
0
        /// <summary>
        /// Start to download.
        /// </summary>
        public void Download()
        {
            // Only idle download client can be started.
            if (this.Status != DownloadStatus.Initialized)
            {
                throw new ApplicationException(
                          "Only Initialized download client can be started.");
            }

            this.EnsurePropertyValid();

            // Set the status.
            this.Status = DownloadStatus.Downloading;

            if (!this.HasChecked)
            {
                string filename = null;
                this.CheckUrlAndFile(out filename);
            }

            HttpDownloadClient client = new HttpDownloadClient(
                this.Url.AbsoluteUri,
                0,
                long.MaxValue,
                this.BufferSize,
                this.BufferCountPerNotification * this.BufferSize,
                this.BufferCountPerNotification);

            // Set the HasChecked flag, so the client will not check the URL again.
            client.TotalSize    = this.TotalSize;
            client.DownloadPath = this.DownloadPath;
            client.HasChecked   = true;
            client.Credentials  = this.Credentials;
            client.Proxy        = this.Proxy;

            // Register the events of HttpDownloadClients.
            client.DownloadProgressChanged += client_DownloadProgressChanged;
            client.StatusChanged           += client_StatusChanged;
            client.DownloadCompleted       += client_DownloadCompleted;

            this.downloadClients.Add(client);
            client.Download();
        }
All Usage Examples Of BiliRanking.Core.Download.HttpDownloadClient::Download