OSDN Git Service

ソフトコレクションファイル対応(branch list4envtrans)をマージ
[applistation/AppliStation.git] / na-get-lib / NaGet.SubCommands / NaGetInstall.cs
index 05f0db1..390f1a0 100644 (file)
@@ -21,6 +21,11 @@ namespace NaGet.SubCommands
                        get {\r
                                if (downloader == null) {\r
                                        downloader = new Downloader();\r
+                                       downloader.DownloadEventRaised += delegate(object sender, DownloadEventArgs e) {\r
+                                               if (e.Type == DownloadEventType.DOWNLOADING && e.TaskProgressPercent > 0) {\r
+                                                       RaiseTaskSetEvent(NaGetTaskSetEventType.PING, string.Empty, GetProgressPercent(NaGetTaskSetEventType.PING, e.TaskProgressPercent));\r
+                                               }\r
+                                       };\r
                                }\r
                                return downloader;\r
                        }\r
@@ -87,7 +92,7 @@ namespace NaGet.SubCommands
                                // ハッシュ非適合なインストーラの表\r
                                List<Installation> invalidInstallers = null;\r
                                \r
-                               while (invalidInstallers == null || invalidInstallers.Count > 0) {\r
+                               do {\r
                                        currentTaskSetIndex = 0;\r
                                        packageInstallerDownloaded = false;\r
                                        \r
@@ -139,9 +144,11 @@ namespace NaGet.SubCommands
                                                                return;\r
                                                }\r
                                        }\r
-                                       currentTaskSetIndex ++;\r
-                                       RaiseTaskSetEvent(NaGetTaskSetEventType.COMPLETED_TASKSET, TaskSetNames[currentTaskSetIndex-1]);\r
-                               }\r
+                                       \r
+                                       // もしハッシュが不適合なソフトがあるならばダウンロード処理からやり直す\r
+                               } while (invalidInstallers == null || invalidInstallers.Count > 0);\r
+                               RaiseTaskSetEvent(NaGetTaskSetEventType.COMPLETED_TASKSET, TaskSetNames[currentTaskSetIndex]);\r
+                               currentTaskSetIndex ++;\r
                        }\r
                        \r
                        foreach (Installation inst in Installations) {\r
@@ -167,9 +174,8 @@ namespace NaGet.SubCommands
                                        done = true;\r
                                        return;\r
                                }\r
-                               currentTaskSetIndex ++;\r
-                               \r
                                RaiseTaskSetEvent(NaGetTaskSetEventType.COMPLETED_TASKSET, installTaskMsg);\r
+                               currentTaskSetIndex ++;\r
                                \r
                                if (cancelCalled) {\r
                                        RaiseTaskSetEvent(NaGetTaskSetEventType.CANCELED, "パッケージのインストール処理がキャンセルされました");\r
@@ -177,7 +183,6 @@ namespace NaGet.SubCommands
                                        return;\r
                                }\r
                        }\r
-                       pkgListMan.SaveSystemInstalledLogList(); // ログのコミット\r
                        \r
                        runLocalUpdate();\r
                        \r
@@ -227,15 +232,14 @@ namespace NaGet.SubCommands
                                                        return;\r
                                                }\r
                                        }\r
-                                       currentTaskSetIndex ++;\r
                                        \r
-                                       if (inst.Downloaded) { // 正常終了\r
-                                               RaiseTaskSetEvent(NaGetTaskSetEventType.COMPLETED_TASKSET, TaskSetNames[currentTaskSetIndex-1]);\r
-                                       } else { // インストールが完了せずに終わった=失敗=エラー\r
+                                       if (! inst.Downloaded) { // インストールが完了せずに終わった=失敗=エラー\r
                                                RaiseTaskSetEvent(NaGetTaskSetEventType.ERROR, string.Format("{0}のインストーラーファイルを正常にダウンロードできませんでした", inst.ToString()));\r
                                                done = true;\r
                                                return;\r
                                        }\r
+                                       RaiseTaskSetEvent(NaGetTaskSetEventType.COMPLETED_TASKSET, TaskSetNames[currentTaskSetIndex]);\r
+                                       currentTaskSetIndex ++;\r
                                        \r
                                        RaiseTaskSetEvent(NaGetTaskSetEventType.STARTED_TASKSET, TaskSetNames[currentTaskSetIndex]);\r
                                        if (! NaGet.Env.EnableScanInstallerFile) {\r
@@ -278,8 +282,8 @@ namespace NaGet.SubCommands
                                                        return;\r
                                                }\r
                                        }\r
+                                       RaiseTaskSetEvent(NaGetTaskSetEventType.COMPLETED_TASKSET, TaskSetNames[currentTaskSetIndex]);\r
                                        currentTaskSetIndex ++;\r
-                                       RaiseTaskSetEvent(NaGetTaskSetEventType.COMPLETED_TASKSET, TaskSetNames[currentTaskSetIndex-1]);\r
                                        \r
                                        if (cancelCalled) {\r
                                                RaiseTaskSetEvent(NaGetTaskSetEventType.CANCELED, "パッケージのインストール処理がキャンセルされました");\r
@@ -324,15 +328,15 @@ namespace NaGet.SubCommands
                        RaiseTaskSetEvent(NaGetTaskSetEventType.STARTED_TASKSET, TaskSetNames[currentTaskSetIndex]);\r
                        pkgListMan.DetectInstalledPkgs();\r
                        pkgListMan.SaveInstalledPackageList();\r
+                       RaiseTaskSetEvent(NaGetTaskSetEventType.COMPLETED_TASKSET, TaskSetNames[currentTaskSetIndex]);\r
                        currentTaskSetIndex++;\r
-                       RaiseTaskSetEvent(NaGetTaskSetEventType.COMPLETED_TASKSET, TaskSetNames[currentTaskSetIndex-1]);\r
                \r
                        // システムにインストールされているリストの更新\r
                        RaiseTaskSetEvent(NaGetTaskSetEventType.STARTED_TASKSET, TaskSetNames[currentTaskSetIndex]);\r
                        pkgListMan.DetectSystemInstalledPkgs();\r
                        pkgListMan.SaveSystemInstalledPackageList();\r
+                       RaiseTaskSetEvent(NaGetTaskSetEventType.COMPLETED_TASKSET, TaskSetNames[currentTaskSetIndex]);\r
                        currentTaskSetIndex++;\r
-                       RaiseTaskSetEvent(NaGetTaskSetEventType.COMPLETED_TASKSET, TaskSetNames[currentTaskSetIndex-1]);\r
                }\r
                \r
                public override bool Done {\r