X-Git-Url: http://git.sourceforge.jp/view?p=applistation%2FAppliStation.git;a=blobdiff_plain;f=na-get-lib%2FNaGet.Net%2FDownloader.cs;h=17dc4de97df0402b569c023716eaee7051510b33;hp=09200012c54429f170b249c7147d2e6098cca133;hb=1b6c2c142b64442bd98d2cd65fd13027bb9fd5c0;hpb=ff4217d2ac0a2f82d2020931b5695e53e6d06bc4 diff --git a/na-get-lib/NaGet.Net/Downloader.cs b/na-get-lib/NaGet.Net/Downloader.cs index 0920001..17dc4de 100644 --- a/na-get-lib/NaGet.Net/Downloader.cs +++ b/na-get-lib/NaGet.Net/Downloader.cs @@ -268,19 +268,19 @@ public class Downloader : NaGetTask case DownloadEventType.STARTED: case DownloadEventType.DOWNLOADING: case DownloadEventType.COMPLETED: - try { + if (e.TaskProgressPercent >= 0) { e.TaskMessage = string.Format("{0} bytes ({1} %)", e.DownloadSize, (int) e.TaskProgressPercent); - } catch (DivideByZeroException) { + } else { e.TaskMessage = string.Format("{0} bytes", e.DownloadSize); } if (stopwatch != null && stopwatch.IsRunning && stopwatch.ElapsedMilliseconds > 3000) { long bpers = e.DownloadSize * 1000 / stopwatch.ElapsedMilliseconds; - try { + if ((e.TaskProgressPercent >= 0) && (bpers > 0)) { TimeSpan rest = TimeSpan.FromSeconds((max - e.DownloadSize) / bpers); e.TaskMessage += string.Format(" 推定残り時間:{0} ({1}/s)", rest, NaGet.Utils.FormatSize(bpers)); - } catch { + } else { e.TaskMessage += string.Format(" ({0}/s)", NaGet.Utils.FormatSize(bpers)); } }