case DownloadEventType.STARTED:\r
case DownloadEventType.DOWNLOADING:\r
case DownloadEventType.COMPLETED:\r
- try {\r
+ if (e.TaskProgressPercent >= 0) {\r
e.TaskMessage = string.Format("{0} bytes ({1} %)", e.DownloadSize, (int) e.TaskProgressPercent);\r
- } catch (DivideByZeroException) {\r
+ } else {\r
e.TaskMessage = string.Format("{0} bytes", e.DownloadSize);\r
}\r
\r
\r
if (stopwatch != null && stopwatch.IsRunning && stopwatch.ElapsedMilliseconds > 3000) {\r
long bpers = e.DownloadSize * 1000 / stopwatch.ElapsedMilliseconds;\r
- try {\r
+ if ((e.TaskProgressPercent >= 0) && (bpers > 0)) {\r
TimeSpan rest = TimeSpan.FromSeconds((max - e.DownloadSize) / bpers);\r
e.TaskMessage += string.Format(" 推定残り時間:{0} ({1}/s)", rest, NaGet.Utils.FormatSize(bpers));\r
- } catch {\r
+ } else {\r
e.TaskMessage += string.Format(" ({0}/s)", NaGet.Utils.FormatSize(bpers));\r
}\r
}\r