Channel9Downloader.Entities.DownloadItem.CalculateEta C# (CSharp) Method

CalculateEta() private method

Calculates the remaining time until the download is finished.
private CalculateEta ( ) : void
return void
        private void CalculateEta()
        {
            if (DownloadState != DownloadState.Downloading ||
                ProgressPercentage >= 100 ||
                BytesPerSecond == 0.0)
            {
                RemainingTime = TimeSpan.FromSeconds(0);
            }
            else
            {
                var remainingBytes = TotalBytesToReceive - BytesReceived;
                var eta = remainingBytes / BytesPerSecond;
                RemainingTime = TimeSpan.FromSeconds(eta);
            }
        }