BiliRanking.Core.Download.HttpDownloadClient.InternalDownloadProgressChanged C# (CSharp) Méthode

InternalDownloadProgressChanged() private méthode

Calculate the download speed and fire the DownloadProgressChanged event.
private InternalDownloadProgressChanged ( int cachedSize ) : void
cachedSize int
Résultat void
        private void InternalDownloadProgressChanged(int cachedSize)
        {
            int speed = 0;
            DateTime current = DateTime.Now;
            TimeSpan interval = current - lastNotificationTime;

            if (interval.TotalSeconds < 60)
            {
                speed = (int)Math.Floor((this.DownloadedSize + cachedSize - this.lastNotificationDownloadedSize) / interval.TotalSeconds);
            }
            lastNotificationTime = current;
            lastNotificationDownloadedSize = this.DownloadedSize + cachedSize;

            this.OnDownloadProgressChanged(new DownloadProgressChangedEventArgs
                           (this.DownloadedSize + cachedSize, this.TotalSize, speed));
        }