Example #1
0
 [M(O.AggressiveInlining)] private static string GetApproxRemainedTimeText(DownloadRow row)
 {
     if (row.Status == DownloadStatus.Running)
     {
         var totalBytes = row.GetApproxTotalBytes();
         if (totalBytes.HasValue)
         {
             var elapsedSeconds = row.GetElapsed().TotalSeconds;
             var downloadBytes  = row.GetDownloadBytesLengthAfterLastRun();
             if ((1_000 < downloadBytes) && (2.5 <= elapsedSeconds))
             {
                 var remainedBytes = totalBytes.Value - (row.DownloadBytesLength - downloadBytes);
                 var remainedTime  = TimeSpan.FromSeconds((remainedBytes - downloadBytes) * (elapsedSeconds / downloadBytes));
                 return(remainedTime.ToString(HH_MM_SS));
             }
         }
     }
     return(string.Empty);
 }
Example #2
0
        [M(O.AggressiveInlining)] private static string GetApproxTotalBytesText(DownloadRow row)
        {
            var size = row.GetApproxTotalBytes();

            return(size.HasValue ? GetDisplaySizeText(size.Value) : string.Empty);
        }