OSDN Git Service

na-get,NaGetInstall(Update)のDownloderを外部から書き込みできないように(これに伴うAppliStation-GUI,all-getの変...
authorttp <ttp@users.sourceforge.jp>
Sat, 5 Jul 2008 04:06:12 +0000 (04:06 +0000)
committerttp <ttp@users.sourceforge.jp>
Sat, 5 Jul 2008 04:06:12 +0000 (04:06 +0000)
結果、TODOが2つ減った

git-svn-id: http://localhost/svn/AppliStation/trunk@933 34ed2c89-c49f-4a4b-abdb-c318350108cf

AppliStation/AppliStation.Util/ExecutionProgressViewer.cs
AppliStation/PackageListViewForm.cs
AppliStation/Program.cs
all-get/Main.cs
na-get-lib/NaGet.Net/Downloader.cs
na-get-lib/NaGet.SubCommands/NaGetInstall.cs
na-get-lib/NaGet.SubCommands/NaGetUpdate.cs

index 94dd6d5..de87382 100644 (file)
@@ -1,4 +1,4 @@
-using System;\r
+using System;\r
 using System.Drawing;\r
 using System.Windows.Forms;\r
 using System.Threading;\r
@@ -14,12 +14,10 @@ namespace AppliStation.Util
        {\r
                private NaGetTaskSet taskSet;\r
                \r
-               private Downloader downloader;\r
-               \r
                private Thread tasksetRunningThread = null;\r
                \r
                /// <summary>\r
-               /// \8fI\97¹\8e\9e\82É\89½\82ð\8ds\82¤\82©\82Ì\83t\83\89\83O\r
+               /// 終了時に何を行うかのフラグ\r
                /// </summary>\r
                public enum ActionOnDoneFlags {\r
                        None = 0,\r
@@ -28,33 +26,26 @@ namespace AppliStation.Util
                }\r
                \r
                /// <summary>\r
-               /// \8fI\97¹\8e\9e\82É\89½\82ð\8ds\82¤\82©\r
+               /// 終了時に何を行うか\r
                /// </summary>\r
                public ActionOnDoneFlags ActionOnDone = ActionOnDoneFlags.FlashWindow;\r
-               \r
-               public Downloader Downloader {\r
-                       get { return downloader; }\r
-               }\r
-               \r
+                               \r
                public ExecutionProgressViewer()\r
                {\r
                        //\r
                        // The InitializeComponent() call is required for Windows Forms designer support.\r
                        //\r
                        InitializeComponent();\r
-                       \r
-                       downloader = new Downloader();\r
-                       downloader.DownloadEventRaised += delegate(object sender, DownloadEventArgs e) {\r
-                               if (InvokeRequired) {\r
-                                       Invoke(new EventHandler<DownloadEventArgs>(onDownloadEvent), sender, e);\r
-                               } else {\r
-                                       onDownloadEvent(sender, e);\r
-                               }\r
-                       };\r
                }\r
-               \r
+                               \r
                private void onDownloadEvent(object sender, DownloadEventArgs a)\r
                {\r
+                       if (InvokeRequired) {\r
+                               Invoke(new EventHandler<DownloadEventArgs>(onDownloadEvent), sender, a);\r
+                               return;\r
+                       }\r
+                       \r
+                       \r
                        if (a.TaskProgressPercent >= 0) {\r
                                progressBarSub.Value = (int) a.TaskProgressPercent;\r
                                progressBarSub.Style = ProgressBarStyle.Continuous;\r
@@ -82,13 +73,13 @@ namespace AppliStation.Util
                                        progressSubLabel.Visible = false;\r
                                        \r
                                        logBox.SelectionColor = System.Drawing.Color.Red;\r
-                                       logBox.AppendText("   [\83G\83\89\81[] " + a.TaskMessage + System.Environment.NewLine);\r
+                                       logBox.AppendText("   [エラー] " + a.TaskMessage + System.Environment.NewLine);\r
                                        logBox.SelectionColor = logBox.ForeColor;\r
                                        break;\r
                        }\r
                }\r
                \r
-               #region NaGetTaskSet\8aÖ\98A\r
+               #region NaGetTaskSet関連\r
                \r
                private void onTaskSetRaised(object sender, NaGetTaskSetEventArgs e)\r
                {\r
@@ -106,7 +97,7 @@ namespace AppliStation.Util
                        \r
                        switch (e.Type) {\r
                                case NaGetTaskSetEventType.COMPLETED:\r
-                                       logBox.AppendText("\8a®\97¹." + System.Environment.NewLine);\r
+                                       logBox.AppendText("完了." + System.Environment.NewLine);\r
                                        if (taskSet.Done) {\r
                                                okButton.Enabled = true;\r
                                                cancelButton.Enabled = false;\r
@@ -120,9 +111,9 @@ namespace AppliStation.Util
                                        if (progressBarSub.Visible) progressBarSub.Hide();\r
                                        if (progressSubLabel.Visible) progressSubLabel.Hide();\r
                                        \r
-                                       NativeMethods.ProgressBar_SetState(progressBar, 1); // VistaProgress\90F\81F\83m\81[\83}\83\8b\r
+                                       NativeMethods.ProgressBar_SetState(progressBar, 1); // VistaProgress色:ノーマル\r
                                        \r
-                                       logBox.AppendText(string.Format(" ... \8a®\97¹. [{0}%]", (int) e.TaskProgressPercent));\r
+                                       logBox.AppendText(string.Format(" ... 完了. [{0}%]", (int) e.TaskProgressPercent));\r
                                        logBox.AppendText(System.Environment.NewLine);\r
                                        break;\r
                                case NaGetTaskSetEventType.INFO:\r
@@ -130,10 +121,10 @@ namespace AppliStation.Util
                                        break;\r
                                case NaGetTaskSetEventType.ERROR:\r
                                        logBox.SelectionColor = System.Drawing.Color.Red;\r
-                                       logBox.AppendText("  [\83G\83\89\81[] " + e.TaskMessage + System.Environment.NewLine);\r
+                                       logBox.AppendText("  [エラー] " + e.TaskMessage + System.Environment.NewLine);\r
                                        logBox.SelectionColor = logBox.ForeColor;\r
                                        \r
-                                       NativeMethods.ProgressBar_SetState(progressBar, 2); // VistaProgress\90F\81F\83G\83\89\81[\r
+                                       NativeMethods.ProgressBar_SetState(progressBar, 2); // VistaProgress色:エラー\r
                                        \r
                                        okButton.Enabled = true;\r
                                        cancelButton.Enabled = false;\r
@@ -143,14 +134,14 @@ namespace AppliStation.Util
                                        logBox.AppendText(e.TaskMessage + System.Environment.NewLine);\r
                                        logBox.SelectionColor = logBox.ForeColor;\r
                                        \r
-                                       NativeMethods.ProgressBar_SetState(progressBar, 1); // VistaProgress\90F\81F\92\86\92f\r
+                                       NativeMethods.ProgressBar_SetState(progressBar, 1); // VistaProgress色:中断\r
                                        \r
                                        okButton.Enabled = true;\r
                                        cancelButton.Enabled = false;\r
                                        break;\r
                                case NaGetTaskSetEventType.WARNING:\r
                                        logBox.SelectionColor = System.Drawing.Color.Red;\r
-                                       logBox.AppendText("  [\83G\83\89\81[] " + e.TaskMessage + System.Environment.NewLine);\r
+                                       logBox.AppendText("  [エラー] " + e.TaskMessage + System.Environment.NewLine);\r
                                        logBox.SelectionColor = logBox.ForeColor;\r
                                        \r
                                        break;\r
@@ -209,6 +200,11 @@ namespace AppliStation.Util
                                }\r
                        };\r
                        \r
+                       System.Reflection.PropertyInfo fDownloader = taskSet.GetType().GetProperty("Downloader");\r
+                       if (fDownloader != null && (fDownloader.PropertyType == typeof(Downloader))) {\r
+                               ((Downloader) fDownloader.GetValue(taskSet, null)).DownloadEventRaised += onDownloadEvent;\r
+                       }\r
+                       \r
                        taskSet.TaskQueryRaised += onTaskQueryRaised;\r
                }\r
 \r
@@ -242,7 +238,7 @@ namespace AppliStation.Util
                        if (taskSet != null && taskSet.Running && taskSet.Cancelable) {\r
                                cancelButton.Enabled = false;\r
                                \r
-                               NativeMethods.ProgressBar_SetState(progressBar, 3); // VistaProgress\90F\81F\92\86\92f\r
+                               NativeMethods.ProgressBar_SetState(progressBar, 3); // VistaProgress色:中断\r
                                \r
                                taskSet.Cancel();\r
                        }\r
index 432f619..304db17 100644 (file)
@@ -1,4 +1,4 @@
-using System;\r
+using System;\r
 using System.Drawing;\r
 using System.Windows.Forms;\r
 using NaGet.Packages;\r
@@ -47,16 +47,16 @@ namespace AppliStation
                                detailBox.SelectedText += string.Format("{0} ({1})\r\n", pkg.Name, pkg.Version);\r
                                if (! string.IsNullOrEmpty(pkg.Tags) ) {\r
                                        detailBox.SelectionFont = new Font(detailBox.Font.FontFamily, 8);\r
-                                       detailBox.SelectedText += string.Format("\83^\83O: {0}\r\n", pkg.Tags);\r
+                                       detailBox.SelectedText += string.Format("タグ: {0}\r\n", pkg.Tags);\r
                                }\r
                                if (isInstalledPackage) {\r
                                        InstalledPackage iPkg = (InstalledPackage) pkg;\r
                                        System.Text.StringBuilder sb = new System.Text.StringBuilder();\r
                                        if (iPkg.UninstallInfo.InstallDate != null) {\r
-                                               sb.AppendFormat("\83C\83\93\83X\83g\81[\83\8b\82µ\82½\93ú: {0:d}  ", iPkg.UninstallInfo.InstallDate.Value);\r
+                                               sb.AppendFormat("インストールした日: {0:d}  ", iPkg.UninstallInfo.InstallDate.Value);\r
                                        }\r
                                        if (iPkg.UninstallInfo.EstimatedSize > 0) {\r
-                                               sb.AppendFormat("\83T\83C\83Y: {0}  ", NaGet.Utils.FormatSize(iPkg.UninstallInfo.EstimatedSize*1024));\r
+                                               sb.AppendFormat("サイズ: {0}  ", NaGet.Utils.FormatSize(iPkg.UninstallInfo.EstimatedSize*1024));\r
                                        }\r
                                        \r
                                        if (sb.Length > 0) {\r
@@ -67,7 +67,7 @@ namespace AppliStation
                                }\r
                                detailBox.SelectionFont = detailBox.Font;\r
                                if (pkg.Url != null && pkg.Url.Href != null) {\r
-                                       detailBox.SelectedText += "\8cö\8e®\83T\83C\83g: " + pkg.Url.Href + "\r\n";\r
+                                       detailBox.SelectedText += "公式サイト: " + pkg.Url.Href + "\r\n";\r
                                }\r
                                detailBox.SelectedText += pkg.Summary;\r
                                \r
@@ -81,8 +81,8 @@ namespace AppliStation
                        if (packageListView.SelectedItems.Count <= 0) {\r
                                detailBox.SelectionFont = detailBox.Font;\r
                                int count = packageListView.Items.Count;\r
-                               detailBox.Text = (count > 0) ? string.Format("{0}\8cÂ\82Ì\83\\83t\83g\82ª\82 \82è\82Ü\82·\81B", count)\r
-                                       : "\8aY\93\96\82·\82é\83\\83t\83g\82ª\82 \82è\82Ü\82¹\82ñ\81B";\r
+                               detailBox.Text = (count > 0) ? string.Format("{0}個のソフトがあります。", count)\r
+                                       : "該当するソフトがありません。";\r
                        }\r
                        \r
                        detailBox.SelectionStart = 0;\r
@@ -132,7 +132,7 @@ namespace AppliStation
                        }\r
                        AppliStation.Util.NativeMethods.ColumnHeader_SetSortState(packageListView, e.Column, order);\r
                        \r
-                       // \83\\81[\83g\91Î\8fÛ\97ñ\82Ì\90F\95t\82¯\r
+                       // ソート対象列の色付け\r
                        try {\r
                                // SendMessage(hWnd, LVM_SETSELECTEDCOLUMN, column, NULL);\r
                                AppliStation.Util.NativeMethods.SendMessage(packageListView.Handle, 0x1000+140, (uint) e.Column, 0);\r
@@ -153,7 +153,7 @@ namespace AppliStation
                        installedSysPackageFilterToolStripMenuItem.Image = ((Icon)(resources.GetObject("sysinstalled.Icon"))).ToBitmap();\r
                }\r
                \r
-               #region PackageFilter\8aÖ\98A\r
+               #region PackageFilter関連\r
                \r
                private enum PackageFilterIndex : int\r
                {\r
@@ -228,11 +228,11 @@ namespace AppliStation
                        \r
                        if (currentPackageFilter == PackageFilterIndex.All || currentPackageFilter == PackageFilterIndex.NotInstalled) {\r
                                foreach (Package pkg in pkgListsMan.AvailablePkgList.Search(searchTextBox.Text)) {\r
-                                       if (Installation.GetPreferInstallerIndex(pkg) >= 0) { // \83C\83\93\83X\83g\81[\83\8b\89Â\94\\r
+                                       if (Installation.GetPreferInstallerIndex(pkg) >= 0) { // インストール可能\r
                                                if (currentPackageFilter == PackageFilterIndex.NotInstalled &&\r
                                                    (pkgListsMan.InstalledPkgList.GetPackageForName(pkg.Name) != null||\r
                                                     pkgListsMan.SystemInstalledPkgList.GetPackageForName(pkg.Name) != null) ) {\r
-                                                       continue; // \83C\83\93\83X\83g\81[\83\8b\8dÏ\82Ý\82Í\8e\9f\82Ì\83\8b\81[\83v\82Ö(\96¢\83C\83\93\83X\83g\81[\83\8b\83\\83t\83g\92\8a\8fo\8e\9e)\r
+                                                       continue; // インストール済みは次のループへ(未インストールソフト抽出時)\r
                                                }\r
                                                \r
                                                ListViewItem item = new ListViewItem(new string[]{pkg.Name, pkg.Version, pkg.Summary});\r
@@ -282,12 +282,11 @@ namespace AppliStation
                        AppliStation.Util.ExecutionProgressViewer prog = new AppliStation.Util.ExecutionProgressViewer();\r
                        prog.Shown += delegate(object sender2, EventArgs e2) {\r
                                NaGet.SubCommands.NaGetUpdate tasks = new NaGet.SubCommands.NaGetUpdate(pkgListsMan, downloadPackageListsFlag);\r
-                               tasks.Downloader = prog.Downloader;\r
                                prog.SetTaskSet(tasks);\r
                                prog.Refresh();\r
                                prog.StartTaskSet();\r
                        };\r
-                       prog.Text = "\83\8a\83X\83g\82Ì\8dX\90V";\r
+                       prog.Text = "リストの更新";\r
                        prog.ShowDialog(this);\r
                }\r
                        \r
@@ -305,7 +304,7 @@ namespace AppliStation
                        UpdatePackageList();\r
                }\r
                \r
-               #region searchTextBox\82Ü\82í\82è\r
+               #region searchTextBoxまわり\r
                \r
                void SearchTextBoxKeyPress(object sender, KeyPressEventArgs e)\r
                {\r
@@ -331,12 +330,11 @@ namespace AppliStation
                        AppliStation.Util.ExecutionProgressViewer prog = new AppliStation.Util.ExecutionProgressViewer();\r
                        prog.Shown += delegate(object sender2, EventArgs e2) {\r
                                NaGet.SubCommands.NaGetInstall tasks = new NaGet.SubCommands.NaGetInstall(pkgListsMan, insts);\r
-                               tasks.Downloader = prog.Downloader;\r
                                prog.SetTaskSet(tasks);\r
                                prog.Refresh();\r
                                prog.StartTaskSet();\r
                        };\r
-                       prog.Text = string.Format("\83\\83t\83g\83E\83F\83A\82Ì\83C\83\93\83X\83g\81[\83\8b");\r
+                       prog.Text = string.Format("ソフトウェアのインストール");\r
                        prog.ShowDialog(this);\r
                }\r
                \r
@@ -389,7 +387,7 @@ namespace AppliStation
                                        }\r
                                };\r
                        } catch (System.ComponentModel.Win32Exception ex) {\r
-                               MessageBox.Show(ex.Message, "\83C\83\93\83X\83g\81[\83\8b", MessageBoxButtons.OK, MessageBoxIcon.Error);\r
+                               MessageBox.Show(ex.Message, "インストール", MessageBoxButtons.OK, MessageBoxIcon.Error);\r
                                \r
                                if (File.Exists(tmpfileName)) {\r
                                        File.Delete(tmpfileName);\r
@@ -407,7 +405,7 @@ namespace AppliStation
                                prog.Refresh();\r
                                prog.StartTaskSet();\r
                        };\r
-                       prog.Text = string.Format("\83\\83t\83g\83E\83F\83A\82Ì\83A\83\93\83C\83\93\83X\83g\81[\83\8b");\r
+                       prog.Text = string.Format("ソフトウェアのアンインストール");\r
                        prog.ShowDialog(this);\r
                }\r
                \r
@@ -439,7 +437,7 @@ namespace AppliStation
                                        }\r
                                };\r
                        } catch (System.ComponentModel.Win32Exception ex) {\r
-                               MessageBox.Show(ex.Message, "\83A\83\93\83C\83\93\83X\83g\81[\83\8b", MessageBoxButtons.OK, MessageBoxIcon.Error);\r
+                               MessageBox.Show(ex.Message, "アンインストール", MessageBoxButtons.OK, MessageBoxIcon.Error);\r
                                \r
                                this.setWindowEnabled(true);\r
                                if (File.Exists(tmpfileName)) {\r
@@ -515,7 +513,7 @@ namespace AppliStation
                        foreach (Package pkg in SelectedPackages<Package>()) {\r
                                PackageInfoForm form = new PackageInfoForm();\r
                                form.SelectedObject = pkg;\r
-                               form.Text = string.Format("{0}({1})\82Ì\83v\83\8d\83p\83e\83B", pkg.Name, pkg.Version);\r
+                               form.Text = string.Format("{0}({1})のプロパティ", pkg.Name, pkg.Version);\r
                                \r
                                form.ShowDialog(this);\r
 \r
@@ -525,7 +523,7 @@ namespace AppliStation
                \r
                void PackageListContextMenuStripOpening(object sender, System.ComponentModel.CancelEventArgs e)\r
                {\r
-                       // \91I\91ð\82³\82ê\82Ä\82¢\82È\82¢\82È\82ç\8aJ\82©\82È\82¢\r
+                       // 選択されていないなら開かない\r
                        if (packageListView.SelectedItems.Count <= 0) {\r
                                e.Cancel = true;\r
                                return;\r
@@ -539,7 +537,7 @@ namespace AppliStation
                                \r
                                webResourcesToolStripMenuItem.Text = string.Format(\r
                                        webResourcesToolStripMenuItem.Tag.ToString(),\r
-                                       pkg.Name.Replace("&", "&&")); // pkg.Name\82É&\82ª\8aÜ\82Ü\82ê\82Ä\82¢\82é\82Æ\82«\82Í\83G\83\93\83R\81[\83h\r
+                                       pkg.Name.Replace("&", "&&")); // pkg.Nameに&が含まれているときはエンコード\r
                                webOfficialToolStripMenuItem.Enabled = ! (pkg.Url == null || string.IsNullOrEmpty(pkg.Url.Href));\r
                                // webGoogleSearchToolStripMenuItem always active.\r
                                \r
@@ -575,7 +573,7 @@ namespace AppliStation
                        pkgs.AddRange(getUpdatedPackages(pkgListsMan.SystemInstalledPkgList, avaiablePackageList, verComp));\r
                        \r
                        if (pkgs.Count <= 0) {\r
-                               MessageBox.Show(this, "\8dX\90V\82³\82ê\82½\83\\83t\83g\82Í\82 \82è\82Ü\82¹\82ñ", "\83\\83t\83g\82Ì\8dX\90V");\r
+                               MessageBox.Show(this, "更新されたソフトはありません", "ソフトの更新");\r
                                return;\r
                        }\r
                        \r
@@ -604,7 +602,7 @@ namespace AppliStation
                }\r
                \r
                /// <summary>\r
-               /// \83C\83\93\83X\83g\81[\83\8b\82·\82é\82æ\82¤\91I\91ð\82³\82ê\82½\83p\83b\83P\81[\83W\82Ì\94z\97ñ\r
+               /// インストールするよう選択されたパッケージの配列\r
                /// </summary>\r
                public TPackage[] SelectedPackages<TPackage>() where TPackage : Package\r
                {\r
@@ -617,9 +615,9 @@ namespace AppliStation
                }\r
                \r
                /// <summary>\r
-               /// \8e©\83E\83B\83\93\83h\83E\82Ì\97L\8cø\96³\8cø(Enabled)\82ð(\95K\97v\82 \82ê\82ÎInvoke\82µ\82Ä)\8eÀ\8ds\82·\82é \r
+               /// 自ウィンドウの有効無効(Enabled)を(必要あればInvokeして)実行する \r
                /// </summary>\r
-               /// <param name="enabled">\97L\8cø\82©\94Û\82©\81BEnabled\82Ì\92l\82É\93ü\82ê\82ç\82ê\82é</param>\r
+               /// <param name="enabled">有効か否か。Enabledの値に入れられる</param>\r
                private void setWindowEnabled(bool enabled)\r
                {\r
                        MethodInvoker process = (MethodInvoker) delegate() {\r
index 496f417..acae4af 100644 (file)
@@ -1,4 +1,4 @@
-using System;\r
+using System;\r
 using System.Collections.Generic;\r
 using System.Windows.Forms;\r
 using System.IO;\r
@@ -12,7 +12,7 @@ namespace AppliStation
                PackageListViewForm form;\r
                \r
                /// <summary>\r
-               /// \83A\83v\83\8a\83P\81[\83V\83\87\83\93\82Ì\83I\83v\83V\83\87\83\93\r
+               /// アプリケーションのオプション\r
                /// </summary>\r
                Dictionary<string, object> appArgs;\r
                \r
@@ -48,10 +48,10 @@ namespace AppliStation
                                hideSplashScreen();\r
                                form.installActionInvoke(insts);\r
                        } catch (UnauthorizedAccessException e) {\r
-                               MessageBox.Show(string.Format("\8aÇ\97\9d\8eÒ\8c \8cÀ\82É\8f¸\8ai\82µ\82Ä\82¢\82È\82¢\82©\81A\8eÀ\8ds\8c \8cÀ\82É\96â\91è\82ª\82 \82è\82Ü\82·\81B\n(\8fÚ\8d×:{0})", e.Message),\r
+                               MessageBox.Show(string.Format("管理者権限に昇格していないか、実行権限に問題があります。\n(詳細:{0})", e.Message),\r
                                                Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Error);\r
                        } catch (FileNotFoundException e) {\r
-                               MessageBox.Show(string.Format("\83\\83t\83g\8ew\92è\83t\83@\83C\83\8b{0}\82ª\8c©\82Â\82©\82è\82Ü\82¹\82ñ", e.FileName),\r
+                               MessageBox.Show(string.Format("ソフト指定ファイル{0}が見つかりません", e.FileName),\r
                                                Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Error);\r
                        }\r
                }\r
@@ -64,10 +64,10 @@ namespace AppliStation
                                hideSplashScreen();\r
                                form.uninstallActionInvoke(pkgs);\r
                        } catch (UnauthorizedAccessException e) {\r
-                               MessageBox.Show(string.Format("\8aÇ\97\9d\8eÒ\8c \8cÀ\82É\8f¸\8ai\82µ\82Ä\82¢\82È\82¢\82©\81A\8eÀ\8ds\8c \8cÀ\82É\96â\91è\82ª\82 \82è\82Ü\82·\81B\n(\8fÚ\8d×:{0})", e.Message),\r
+                               MessageBox.Show(string.Format("管理者権限に昇格していないか、実行権限に問題があります。\n(詳細:{0})", e.Message),\r
                                                Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Error);\r
                        } catch (FileNotFoundException e) {\r
-                               MessageBox.Show(string.Format("\83\\83t\83g\8ew\92è\83t\83@\83C\83\8b{0}\82ª\8c©\82Â\82©\82è\82Ü\82¹\82ñ", e.FileName),\r
+                               MessageBox.Show(string.Format("ソフト指定ファイル{0}が見つかりません", e.FileName),\r
                                                Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Error);\r
                        }\r
                }\r
@@ -85,7 +85,7 @@ namespace AppliStation
                        try {\r
                                parseArgs(args);\r
                        } catch (ApplicationException e) {\r
-                               MessageBox.Show(e.Message, "AppliStation \8bN\93®\88ø\90\94\83G\83\89\81[", MessageBoxButtons.OK, MessageBoxIcon.Error);\r
+                               MessageBox.Show(e.Message, "AppliStation 起動引数エラー", MessageBoxButtons.OK, MessageBoxIcon.Error);\r
                                return;\r
                        }\r
                        \r
@@ -114,7 +114,7 @@ namespace AppliStation
                        Form splashScreen = null;\r
                        \r
                        try {\r
-                               if (args.Length <= 0) { // HACK \88ø\90\94\83p\81[\83X\82Ì\8e\9e\8aÔ\82³\82¦\91Ò\82Ä\82È\82¢\82Ì\82Å\88ø\90\94\82Ì\97L\96³\82Å\95\\8e¦\82ð\94»\92f\r
+                               if (args.Length <= 0) { // HACK 引数パースの時間さえ待てないので引数の有無で表示を判断\r
                                        splashScreen = new Form();\r
                                        splashScreen.FormBorderStyle = FormBorderStyle.None;\r
                                        splashScreen.BackgroundImage = System.Drawing.Bitmap.FromFile(Path.Combine(Path.GetDirectoryName(Application.ExecutablePath), "SplashScreen.png"));\r
@@ -125,8 +125,8 @@ namespace AppliStation
                                        splashScreen.Show();\r
                                }\r
                                \r
-                               ToolStripManager.VisualStylesEnabled = false; // ToolStrip\82ªLuna\82Å\90Â\82­\82È\82ç\82È\82¢\82æ\82¤\82É\r
-                               Application.EnableVisualStyles(); // Luna\82âVista\82Ì\83f\83U\83C\83\93\82ð\97L\8cø\82É\r
+                               ToolStripManager.VisualStylesEnabled = false; // ToolStripがLunaで青くならないように\r
+                               Application.EnableVisualStyles(); // LunaやVistaのデザインを有効に\r
                                \r
                                Application.ThreadException += AppliStation.Util.ExceptionDialogForm.Application_ThrowException;\r
                                System.Threading.Thread.GetDomain().UnhandledException += AppliStation.Util.ExceptionDialogForm.Application_ThrowException;\r
index 90eb234..592f7ef 100644 (file)
@@ -95,7 +95,6 @@ namespace AllGet
                public void update(bool downloadPackageListFlag)\r
                {\r
                        NaGet.SubCommands.NaGetUpdate tasks = new NaGet.SubCommands.NaGetUpdate(pkgListMan, downloadPackageListFlag);\r
-                       tasks.Downloader = this.downloader;\r
                        tasks.TaskSetRaised += delegate(object sender, NaGetTaskSetEventArgs e) { \r
                                switch (e.Type) {\r
 //                                     case NaGetTaskSetEventType.COMPLETED_TASKSET\r
@@ -118,6 +117,8 @@ namespace AllGet
                                                break;\r
                                }\r
                        };\r
+                       DownloadListener dl = new DownloadListener();\r
+                       tasks.Downloader.DownloadEventRaised += dl.OnDownload;\r
                        \r
                        tasks.Run();\r
                }\r
@@ -296,7 +297,6 @@ namespace AllGet
                        }\r
                        \r
                        NaGet.SubCommands.NaGetInstall tasks = new NaGet.SubCommands.NaGetInstall(pkgListMan, installations);\r
-                       tasks.Downloader = this.downloader;\r
                        tasks.TaskQueryRaised += delegate(object sender, NaGetTaskQueryArgs e) {\r
                                char result = '\u0000';\r
                                if (e.SelectionFlag == (NaGetTaskQueryResult.CONTINUE | NaGetTaskQueryResult.RETRY | NaGetTaskQueryResult.CANCEL)) {\r
@@ -342,6 +342,8 @@ namespace AllGet
                                                break;\r
                                }\r
                        };\r
+                       DownloadListener dl = new DownloadListener();\r
+                       tasks.Downloader.DownloadEventRaised += dl.OnDownload;\r
                        \r
                        tasks.Run();\r
                }\r
index 926f947..0920001 100644 (file)
@@ -78,14 +78,31 @@ public class Downloader : NaGetTask
        /// </summary>\r
        public event EventHandler<DownloadEventArgs> DownloadEventRaised;\r
        \r
+       /// <summary>\r
+       /// アクセスURL\r
+       /// </summary>\r
        protected string url;\r
        \r
+       /// <summary>\r
+       /// 保存先\r
+       /// </summary>\r
        protected string filepath;\r
        \r
+       /// <summary>\r
+       /// リクエストオブジェクト\r
+       /// </summary>\r
        protected WebRequest request;\r
        \r
+       /// <summary>\r
+       /// レスポンスオブジェクト。応答がくるまではnullである。\r
+       /// </summary>\r
        protected WebResponse response;\r
        \r
+       /// <summary>\r
+       /// ダウンロード要求時のキャッシュレベル。デフォルトではキャッシュ無視\r
+       /// </summary>\r
+       public System.Net.Cache.RequestCacheLevel CacheLevel = System.Net.Cache.RequestCacheLevel.NoCacheNoStore;\r
+       \r
        private bool cancelCalled = false;\r
        \r
        private bool done = false;\r
@@ -136,11 +153,8 @@ public class Downloader : NaGetTask
                \r
                try {\r
                        request = WebRequest.Create(url);\r
-                       request.Proxy = (Proxy == null)? DefaultProxy : Proxy;    \r
-                       if (request is HttpWebRequest) {\r
-                               request.CachePolicy = new System.Net.Cache.HttpRequestCachePolicy(\r
-                                       System.Net.Cache.HttpRequestCacheLevel.NoCacheNoStore);\r
-                       }\r
+                       request.Proxy = (Proxy == null)? DefaultProxy : Proxy;\r
+                       request.CachePolicy = new System.Net.Cache.RequestCachePolicy(CacheLevel);\r
                        \r
                        if (cancelCalled) {\r
                                throw new NaGetTaskCanceledException(string.Empty);\r
index e000ff7..9e626b8 100644 (file)
@@ -1,4 +1,4 @@
-using System;\r
+using System;\r
 using NaGet.Packages.Install;\r
 using NaGet.Packages;\r
 using NaGet.Net;\r
@@ -13,7 +13,19 @@ namespace NaGet.SubCommands
                \r
                private PackageListsManager pkgListMan;\r
                \r
-               public Downloader Downloader; // TODO \8eQ\8fÆ\82ð\82µ\82Ä\83Z\83b\83g\82·\82é\82æ\82¤\82É\r
+               /// <summary>\r
+               /// ダウンロードに使うダウンローダオブジェクト\r
+               /// </summary>\r
+               public Downloader Downloader {\r
+                       get {\r
+                               if (downloader == null) {\r
+                                       downloader = new Downloader();\r
+                               }\r
+                               return downloader;\r
+                       }\r
+               }\r
+               \r
+               private Downloader downloader;\r
                \r
                private bool packageInstallerDownloaded = false;\r
                \r
@@ -22,23 +34,23 @@ namespace NaGet.SubCommands
                }\r
                \r
                /// <summary>\r
-               /// \83C\83\93\83X\83g\81[\83\8b\82·\82é\83p\83b\83P\81[\83W\r
+               /// インストールするパッケージ\r
                /// </summary>\r
                public Installation[] Installations;\r
                \r
                /// <summary>\r
-               /// \83R\83\93\83X\83g\83\89\83N\83^\r
+               /// コンストラクタ\r
                /// </summary>\r
-               /// <param name="pkgs">\83C\83\93\83X\83g\81[\83\8b\82·\82é\83p\83b\83P\81[\83W</param>\r
+               /// <param name="pkgs">インストールするパッケージ</param>\r
                public NaGetInstall(PackageListsManager pkgListMan, Package[] pkgs)\r
                        : this(pkgListMan, Installation.ConvertInstallations(pkgs))\r
                {\r
                }\r
                \r
                /// <summary>\r
-               /// \83R\83\93\83X\83g\83\89\83N\83^\r
+               /// コンストラクタ\r
                /// </summary>\r
-               /// <param name="installations">\83C\83\93\83X\83g\81[\83\8b\8f\88\97\9d\82Ì\94z\97ñ</param>\r
+               /// <param name="installations">インストール処理の配列</param>\r
                public NaGetInstall(PackageListsManager pkgMan, Installation[] installations)\r
                {\r
                        pkgListMan = pkgMan;\r
@@ -52,14 +64,14 @@ namespace NaGet.SubCommands
                        System.Collections.Generic.List<string> taskSetNames = new System.Collections.Generic.List<string>();\r
                        \r
                        for (int i =0; i < Installations.Length; i++) {\r
-                               taskSetNames.Add(string.Format("\8eæ\93¾: {0}", Installations[i].ToString()));\r
+                               taskSetNames.Add(string.Format("取得: {0}", Installations[i].ToString()));\r
                        }\r
-                       taskSetNames.Add("\83C\83\93\83X\83g\81[\83\89\82Ì\8c\9f\8fØ");\r
+                       taskSetNames.Add("インストーラの検証");\r
                        for (int i =0; i < Installations.Length; i++) {\r
-                               taskSetNames.Add(string.Format("\83C\83\93\83X\83g\81[\83\8b: {0}", Installations[i].ToString()));\r
+                               taskSetNames.Add(string.Format("インストール: {0}", Installations[i].ToString()));\r
                        }\r
-                       taskSetNames.Add(string.Format("\83\8a\83X\83g\8dX\90V: {0}", NaGet.Env.ArchiveInstalledPackageListFile));\r
-                       taskSetNames.Add(string.Format("\83\8a\83X\83g\8dX\90V: {0}", NaGet.Env.SystemInstalledPackageListFile));\r
+                       taskSetNames.Add(string.Format("リスト更新: {0}", NaGet.Env.ArchiveInstalledPackageListFile));\r
+                       taskSetNames.Add(string.Format("リスト更新: {0}", NaGet.Env.SystemInstalledPackageListFile));\r
                        \r
                        TaskSetNames = taskSetNames.ToArray();\r
                }\r
@@ -67,10 +79,10 @@ namespace NaGet.SubCommands
                public override void Run()\r
                {\r
                        currentTaskSetIndex = 0;\r
-                       RaiseTaskSetEvent(NaGetTaskSetEventType.STARTED, "\83C\83\93\83X\83g\81[\83\8b\8f\88\97\9d\8aJ\8en");\r
+                       RaiseTaskSetEvent(NaGetTaskSetEventType.STARTED, "インストール処理開始");\r
                        \r
                        {\r
-                               // \83n\83b\83V\83\85\94ñ\93K\8d\87\82È\83C\83\93\83X\83g\81[\83\89\82Ì\95\\r
+                               // ハッシュ非適合なインストーラの表\r
                                System.Collections.Generic.List<Installation> invalidInstallers = null;\r
                                \r
                                while (invalidInstallers == null || invalidInstallers.Count > 0) {\r
@@ -78,16 +90,16 @@ namespace NaGet.SubCommands
                                        packageInstallerDownloaded = false;\r
                                        \r
                                        runDownloadInstallers();\r
-                                       if (done) return; // \82à\82µrunDownloadInstallers()\93à\82Å\83G\83\89\81[\8fI\97¹\82µ\82Ä\82¢\82½\82È\82ç\8fI\97¹\r
+                                       if (done) return; // もしrunDownloadInstallers()内でエラー終了していたなら終了\r
                                        \r
                                        packageInstallerDownloaded = true;\r
                                        \r
-                                       // \83n\83b\83V\83\85\82Ì\89ó\82ê\82Ä\82¢\82é\83C\83\93\83X\83g\81[\83\89\82ð\8eæ\93¾\r
+                                       // ハッシュの壊れているインストーラを取得\r
                                        invalidInstallers = runCheckHashForInstaller();\r
                                        \r
-                                       // \83n\83b\83V\83\85\82ª\89ó\82ê\82Ä\82¢\82é\82Æ\82«\82Ì\91Î\8dô\r
+                                       // ハッシュが壊れているときの対策\r
                                        if (invalidInstallers.Count > 0) {\r
-                                               string msg = string.Format("{0}\8cÂ\82Ì\83p\83b\83P\81[\83W\82Å\83t\83@\83C\83\8b\82ª\89ó\82ê\82Ä\82¢\82é\89Â\94\\90«\82ª\82 \82è\82Ü\82·\n\8b­\90§\93I\82É\83C\83\93\83X\83g\81[\83\8b\82ð\91±\8ds\82µ\82Ü\82·\82©?",\r
+                                               string msg = string.Format("{0}個のパッケージでファイルが壊れている可能性があります\n強制的にインストールを続行しますか?",\r
                                                                           invalidInstallers.Count);\r
                                                NaGetTaskQueryResult result = RaiseTaskSetQueryEvent(msg, NaGetTaskQueryResult.CONTINUE\r
                                                                                                     | NaGetTaskQueryResult.RETRY\r
@@ -95,11 +107,11 @@ namespace NaGet.SubCommands
                                                \r
                                                switch (result) {\r
                                                        case NaGetTaskQueryResult.CONTINUE:\r
-                                                               RaiseTaskSetEvent(NaGetTaskSetEventType.WARNING, "\83n\83b\83V\83\85\82Ì\94ñ\90®\8d\87\82ð\96³\8e\8b\82µ\82Ä\83C\83\93\83X\83g\81[\83\8b\82ð\8cp\91±");\r
-                                                               invalidInstallers.Clear(); // \83n\83b\83V\83\85\94ñ\93K\8d\87\83p\83b\83P\81[\83W\82ð\8b­\90§\93I\82É\96\95\8fÁ\r
+                                                               RaiseTaskSetEvent(NaGetTaskSetEventType.WARNING, "ハッシュの非整合を無視してインストールを継続");\r
+                                                               invalidInstallers.Clear(); // ハッシュ非適合パッケージを強制的に抹消\r
                                                                break;\r
                                                        case NaGetTaskQueryResult.RETRY:\r
-                                                               RaiseTaskSetEvent(NaGetTaskSetEventType.INFO, "\83_\83E\83\93\83\8d\81[\83h\8f\88\97\9d\82ð\8dÄ\8e\8e\8ds");\r
+                                                               RaiseTaskSetEvent(NaGetTaskSetEventType.INFO, "ダウンロード処理を再試行");\r
                                                                \r
                                                                foreach (Installation invalidInst in invalidInstallers) {\r
                                                                        invalidInst.RemoveDownloadedFile();\r
@@ -108,7 +120,7 @@ namespace NaGet.SubCommands
                                                                break;\r
                                                        //case NaGetTaskQueryResult.CANCEL:\r
                                                        default:\r
-                                                               RaiseTaskSetEvent(NaGetTaskSetEventType.CANCELED, "\83p\83b\83P\81[\83W\82Ì\83C\83\93\83X\83g\81[\83\8b\8f\88\97\9d\82ª\83L\83\83\83\93\83Z\83\8b\82³\82ê\82Ü\82µ\82½");\r
+                                                               RaiseTaskSetEvent(NaGetTaskSetEventType.CANCELED, "パッケージのインストール処理がキャンセルされました");\r
                                                                done = true;\r
                                                                return;\r
                                                }\r
@@ -120,7 +132,7 @@ namespace NaGet.SubCommands
                        foreach (Installation inst in Installations) {\r
                                string installTaskMsg = inst.ToString();\r
                                if (inst.Silent && (!inst.SupportsSilentOnly)) {\r
-                                       installTaskMsg += " (\83T\83C\83\8c\83\93\83g\83C\83\93\83X\83g\81[\83\8b)";\r
+                                       installTaskMsg += " (サイレントインストール)";\r
                                }\r
                                \r
                                RaiseTaskSetEvent(NaGetTaskSetEventType.STARTED_TASKSET, installTaskMsg);\r
@@ -131,7 +143,7 @@ namespace NaGet.SubCommands
                                        inst.OutputDataReceived += this.ReceivedOutputData;\r
                                        int exitCode = inst.Install();\r
                                        if (exitCode != 0) {\r
-                                               RaiseTaskSetEvent(NaGetTaskSetEventType.WARNING, "\83C\83\93\83X\83g\81[\83\8b\82ª\90³\8fí\82É\8fI\82¦\82Ä\82¢\82È\82¢\89Â\94\\90«\82ª\82 \82è\82Ü\82·\81B\83C\83\93\83X\83g\81[\83\89\82Ì\8fI\97¹\83R\81[\83h:"+exitCode);\r
+                                               RaiseTaskSetEvent(NaGetTaskSetEventType.WARNING, "インストールが正常に終えていない可能性があります。インストーラの終了コード:"+exitCode);\r
                                        }\r
                                        \r
                                        pkgListMan.WriteInstallationLog(inst);\r
@@ -145,29 +157,29 @@ namespace NaGet.SubCommands
                                RaiseTaskSetEvent(NaGetTaskSetEventType.COMPLETED_TASKSET, installTaskMsg);\r
                                \r
                                if (cancelCalled) {\r
-                                       RaiseTaskSetEvent(NaGetTaskSetEventType.CANCELED, "\83p\83b\83P\81[\83W\82Ì\83C\83\93\83X\83g\81[\83\8b\8f\88\97\9d\82ª\83L\83\83\83\93\83Z\83\8b\82³\82ê\82Ü\82µ\82½");\r
+                                       RaiseTaskSetEvent(NaGetTaskSetEventType.CANCELED, "パッケージのインストール処理がキャンセルされました");\r
                                        done = true;\r
                                        return;\r
                                }\r
                        }\r
-                       pkgListMan.SaveSystemInstalledLogList(); // \83\8d\83O\82Ì\83R\83~\83b\83g\r
+                       pkgListMan.SaveSystemInstalledLogList(); // ログのコミット\r
                        \r
                        runLocalUpdate();\r
                        \r
                        done = true;\r
                        \r
-                       RaiseTaskSetEvent(NaGetTaskSetEventType.COMPLETED, "\8fI\97¹", 100);\r
+                       RaiseTaskSetEvent(NaGetTaskSetEventType.COMPLETED, "終了", 100);\r
                }\r
                \r
                \r
                /// <summary>\r
-               /// \8f\88\97\9d\93à\97e\82Ì\83_\83E\83\93\83\8d\81[\83h\95\94\95ª\82Ì\83T\83u\83\8b\81[\83`\83\93\r
+               /// 処理内容のダウンロード部分のサブルーチン\r
                /// </summary>\r
                private void runDownloadInstallers()\r
                {\r
                        foreach (Installation inst in Installations) {\r
                                if (! inst.IsInstallablePackage()) {\r
-                                       string msg = string.Format("{0}\82Í\83C\83\93\83X\83g\81[\83\8b\82·\82é\82±\82Æ\82ª\82Å\82«\82Ü\82¹\82ñ", inst.ToString());\r
+                                       string msg = string.Format("{0}はインストールすることができません", inst.ToString());\r
                                        \r
                                        RaiseTaskSetEvent(NaGetTaskSetEventType.ERROR, msg);\r
                                        done = true;\r
@@ -180,15 +192,15 @@ namespace NaGet.SubCommands
                                        try {\r
                                                inst.Download(Downloader);\r
                                        } catch (NaGetTaskCanceledException) {\r
-                                               RaiseTaskSetEvent(NaGetTaskSetEventType.CANCELED, "\83C\83\93\83X\83g\81[\83\89\82Ì\83_\83E\83\93\83\8d\81[\83h\8f\88\97\9d\82ª\83L\83\83\83\93\83Z\83\8b\82³\82ê\82Ü\82µ\82½");\r
+                                               RaiseTaskSetEvent(NaGetTaskSetEventType.CANCELED, "インストーラのダウンロード処理がキャンセルされました");\r
                                                done = true;\r
                                                return;\r
                                        } catch (System.Net.WebException e) {\r
                                                RaiseTaskSetEvent(NaGetTaskSetEventType.WARNING, e.Message);\r
                                                if (System.Net.NetworkInformation.NetworkInterface.GetIsNetworkAvailable()) {\r
-                                                       RaiseTaskSetEvent(NaGetTaskSetEventType.ERROR, "\83l\83b\83g\83\8f\81[\83N\82É\90Ú\91±\82³\82ê\82Ä\82¢\82Ü\82¹\82ñ\81B");\r
+                                                       RaiseTaskSetEvent(NaGetTaskSetEventType.ERROR, "ネットワークに接続されていません。");\r
                                                } else {\r
-                                                       RaiseTaskSetEvent(NaGetTaskSetEventType.ERROR, "\83l\83b\83g\83\8f\81[\83N\82É\90Ú\91±\82Å\82«\82Ü\82¹\82ñ\82Å\82µ\82½\81B\83l\83b\83g\83\8f\81[\83N\82ª\90Ø\92f\82³\82ê\82Ä\82¢\82é\82©\81A\83t\83@\83C\83A\83E\83H\81[\83\8b\82É\82æ\82Á\82Ä\8eÕ\92f\82³\82ê\82½\89Â\94\\90«\82ª\82 \82è\82Ü\82·\81B");\r
+                                                       RaiseTaskSetEvent(NaGetTaskSetEventType.ERROR, "ネットワークに接続できませんでした。ネットワークが切断されているか、ファイアウォールによって遮断された可能性があります。");\r
                                                }\r
                                                done = true;\r
                                                return;\r
@@ -200,18 +212,18 @@ namespace NaGet.SubCommands
                                }\r
                                currentTaskSetIndex ++;\r
                                \r
-                               if (inst.Downloaded) { // \90³\8fí\8fI\97¹\r
+                               if (inst.Downloaded) { // 正常終了\r
                                        RaiseTaskSetEvent(NaGetTaskSetEventType.COMPLETED_TASKSET, inst.ToString());\r
-                               } else { // \83C\83\93\83X\83g\81[\83\8b\82ª\8a®\97¹\82¹\82¸\82É\8fI\82í\82Á\82½=\8e¸\94s=\83G\83\89\81[\r
-                                       RaiseTaskSetEvent(NaGetTaskSetEventType.ERROR, string.Format("{0}\82Ì\83C\83\93\83X\83g\81[\83\89\82ð\90³\8fí\82É\83_\83E\83\93\83\8d\81[\83h\82Å\82«\82Ü\82¹\82ñ\82Å\82µ\82½", inst.ToString()));\r
+                               } else { // インストールが完了せずに終わった=失敗=エラー\r
+                                       RaiseTaskSetEvent(NaGetTaskSetEventType.ERROR, string.Format("{0}のインストーラを正常にダウンロードできませんでした", inst.ToString()));\r
                                }\r
                        }\r
                }\r
                \r
                /// <summary>\r
-               /// \83_\83E\83\93\83\8d\81[\83h\82µ\82½\83p\83b\83P\81[\83W\82ª\90®\8d\87\82µ\82½\82©\94Û\82©\83n\83b\83V\83\85\82Å\83`\83F\83b\83N\r
+               /// ダウンロードしたパッケージが整合したか否かハッシュでチェック\r
                /// </summary>\r
-               /// <returns>\90®\8d\87\82µ\82È\82©\82Á\82½\83C\83\93\83X\83g\81[\83\89\82Ì\83\8a\83X\83g</returns>\r
+               /// <returns>整合しなかったインストーラのリスト</returns>\r
                private System.Collections.Generic.List<Installation> runCheckHashForInstaller()\r
                {\r
                        System.Collections.Generic.List<Installation> invalidInstallers = new System.Collections.Generic.List<Installation>();\r
@@ -221,13 +233,13 @@ namespace NaGet.SubCommands
                                float percent = (CurrentTaskSetIndex+((float)i / Installations.Length))*100f/TaskSetNames.Length;\r
                                \r
                                if (inst.GetRegisteredHashCount() > 0) {\r
-                                       RaiseTaskSetEvent(NaGetTaskSetEventType.INFO, "\8c\9f\8fØ: "+inst.ToString(), percent);\r
+                                       RaiseTaskSetEvent(NaGetTaskSetEventType.INFO, "検証: "+inst.ToString(), percent);\r
                                        \r
                                        if (inst.IsInstallablePackage() && inst.VerifyHashValues() == false) {\r
                                                invalidInstallers.Add(inst);\r
-                                               RaiseTaskSetEvent(NaGetTaskSetEventType.WARNING, "\8c\9f\8fØ: "+inst.ToString() + " \94ñ\90®\8d\87", percent);\r
+                                               RaiseTaskSetEvent(NaGetTaskSetEventType.WARNING, "検証: "+inst.ToString() + " 非整合", percent);\r
                                        } else {\r
-                                               RaiseTaskSetEvent(NaGetTaskSetEventType.INFO, "\8c\9f\8fØ: "+inst.ToString() + " OK", percent);\r
+                                               RaiseTaskSetEvent(NaGetTaskSetEventType.INFO, "検証: "+inst.ToString() + " OK", percent);\r
                                        }\r
                                }\r
                                i++;\r
@@ -238,14 +250,14 @@ namespace NaGet.SubCommands
                \r
                private void runLocalUpdate()\r
                {\r
-                       // \83C\83\93\83X\83g\81[\83\8b\83g\83\8a\83X\83g\82Ì\8dX\90V\r
+                       // インストールトリストの更新\r
                        RaiseTaskSetEvent(NaGetTaskSetEventType.STARTED_TASKSET, TaskSetNames[currentTaskSetIndex]);\r
                        pkgListMan.DetectInstalledPkgs();\r
                        pkgListMan.SaveInstalledPackageList();\r
                        currentTaskSetIndex++;\r
                        RaiseTaskSetEvent(NaGetTaskSetEventType.COMPLETED_TASKSET, TaskSetNames[currentTaskSetIndex-1]);\r
                \r
-                       // \83V\83X\83e\83\80\82É\83C\83\93\83X\83g\81[\83\8b\82³\82ê\82Ä\82¢\82é\83\8a\83X\83g\82Ì\8dX\90V\r
+                       // システムにインストールされているリストの更新\r
                        RaiseTaskSetEvent(NaGetTaskSetEventType.STARTED_TASKSET, TaskSetNames[currentTaskSetIndex]);\r
                        pkgListMan.DetectSystemInstalledPkgs();\r
                        pkgListMan.SaveSystemInstalledPackageList();\r
index 0524292..9807e1a 100644 (file)
@@ -17,7 +17,20 @@ namespace NaGet.SubCommands
                \r
                private bool packageListsDownloaded = true;\r
                \r
-               public Downloader Downloader; // TODO 参照をしてセットするように\r
+               \r
+               /// <summary>\r
+               /// ダウンロードに使うダウンローダオブジェクト\r
+               /// </summary>\r
+               public Downloader Downloader {\r
+                       get {\r
+                               if (downloader == null) {\r
+                                       downloader = new Downloader();\r
+                               }\r
+                               return downloader;\r
+                       }\r
+               }\r
+               \r
+               private Downloader downloader;\r
                \r
                private int currentTaskSetIndex = -1;\r
                \r