Exemplo n.º 1
0
        /// <summary>
        /// Esimated Finishing Time (by Download Time)
        /// </summary>
        private TimeSpan GetEftByDownloadTime(TimeSpan frameTime)
        {
            if (DownloadTime.IsUnknown())
            {
                return(TimeSpan.Zero);
            }

            if (FinishedTime.IsKnown())
            {
                return(FinishedTime.Subtract(DownloadTime));
            }

            // Issue 156 - ETA must be a positive TimeSpan
            // Issue 134 - Since fixing Issue 156 it appears that once most
            // bigadv units finish their last frame they would be assigned a
            // Zero EFT since their ETA values would have been zero and they
            // had not yet written the FinishedTime to the queue.dat file.
            // In light of this I've added the AllFramesAreCompleted property.
            // Now, if ETA is Zero and AllFramesAreCompleted == false, the EFT
            // will be Zero.  Otherwise, it will be given a value of the
            // (UnitRetrievalTime plus ETA) minus the DownloadTime.
            TimeSpan eta = GetEta(frameTime);

            if (eta.IsZero() && AllFramesCompleted == false)
            {
                return(TimeSpan.Zero);
            }

            return(_unitInfo.UnitRetrievalTime.Add(eta).Subtract(DownloadTime));
        }
Exemplo n.º 2
0
        private TimeSpan GetUnitTimeByDownloadTime(TimeSpan frameTime)
        {
            if (DownloadTime.IsUnknown())
            {
                return(TimeSpan.Zero);
            }
            if (FinishedTime.IsKnown())
            {
                return(FinishedTime.Subtract(DownloadTime));
            }

            // If ETA is Zero and AllFramesAreCompleted == false, the Unit Time
            // will be Zero.  Otherwise, it will be given a value of the
            // (UnitRetrievalTime plus ETA) minus the DownloadTime.
            TimeSpan eta = GetEta(frameTime);

            if (eta == TimeSpan.Zero && AllFramesCompleted == false)
            {
                return(TimeSpan.Zero);
            }

            return(_unitInfo.UnitRetrievalTime.Add(eta).Subtract(DownloadTime));
        }