OSDN Git Service

AppliStation-GUI,UserPrefForm.csへのコメント追加
[applistation/AppliStation.git] / AppliStation / PackageUninstallConfirmForm.cs
index b922f24..2cc85fe 100644 (file)
@@ -1,4 +1,5 @@
-using System;\r
+using System;\r
+using System.IO;\r
 using System.Drawing;\r
 using System.Windows.Forms;\r
 using NaGet.Packages;\r
@@ -21,19 +22,14 @@ namespace AppliStation
                                label2.Text = string.Format("{0}({1})", uninstallPackage.Name, uninstallPackage.Version);\r
                                label2.Font = new Font(SystemFonts.DefaultFont.FontFamily, SystemFonts.DefaultFont.Size*1.5f);\r
                                \r
-                               string iconPath = uninstallPackage.UninstallInfo.IconPath;\r
-                               if (!string.IsNullOrEmpty(iconPath)) {\r
-                                       if (iconPath.EndsWith(",0")) {\r
-                                               iconPath = iconPath.Substring(0, iconPath.Length-2);\r
-                                       }\r
-                                       if (System.IO.File.Exists(iconPath)) {\r
-                                               iconLabel.Image = Icon.ExtractAssociatedIcon(iconPath).ToBitmap();\r
-                                               iconLabel.Size = iconLabel.Image.Size;\r
-                                       }\r
+                               Icon icon = AppliStation.Util.GUIUtils.GetIconForPackage(uninstallPackage);\r
+                               if (icon != null) {\r
+                                       iconLabel.Image = icon.ToBitmap();\r
+                                       iconLabel.Size = icon.Size;\r
                                }\r
                        }\r
                }\r
-               \r
+\r
                public PackageUninstallConfirmForm()\r
                {\r
                        //\r
@@ -41,17 +37,17 @@ namespace AppliStation
                        //\r
                        InitializeComponent();\r
                        \r
-                       // \8aÇ\97\9d\8eÒ\8c \8cÀ\82Å\93®\82¢\82Ä\82¢\82é\82È\82ç\82Îrunas\82ª\95K\97v\82É\82Í\82È\82ç\82È\82¢\82Ì\82Å\95\\8e¦\82µ\82È\82¢\r
+                       // 管理者権限で動いているならばrunasが必要にはならないので表示しない\r
                        if (NaGet.Utils.IsAdministrators()) {\r
                                runasCheckBox.Checked = false;\r
                                runasCheckBox.Visible = false;\r
                        }\r
                }\r
                \r
-               #region runas\8aÖ\98A\r
+               #region runas関連\r
                \r
                /// <summary>\r
-               /// runas\82Å\8eÀ\8ds\82·\82é\82©\94Û\82©\r
+               /// runasで実行するか否か\r
                /// </summary>\r
                public bool UseRunas {\r
                        set {\r
@@ -65,12 +61,12 @@ namespace AppliStation
                }\r
                \r
                /// <summary>\r
-               /// \91I\91ð\82³\82ê\82½\83p\83b\83P\81[\83W\82ð\92²\8d¸\82µ\82Ä\81ARunas\82ð\8eg\82¤\82×\82«\82©\82¢\82È\82©\82ð\95Ô\82·\r
+               /// 選択されたパッケージを調査して、Runasを使うべきかいなかを返す\r
                /// </summary>\r
                public bool GetShouldUseRunas()\r
                {\r
                        if (NaGet.Utils.IsAdministrators()) {\r
-                               // \8aÇ\97\9d\8eÒ\8c \8cÀ\82Å\93®\82¢\82Ä\82¢\82é\8fê\8d\87\82Í\95s\97v\r
+                               // 管理者権限で動いている場合は不要\r
                                return false;   \r
                        }\r
                        \r
@@ -85,7 +81,7 @@ namespace AppliStation
                private void updateUseRunas()\r
                {\r
                        if (UseRunas) {\r
-                               System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(PackagesInstallConfirmForm));\r
+                               System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(InstallationConfirmForm));\r
                                okButton.Image = ((System.Drawing.Bitmap)(resources.GetObject("okButton.Image")));\r
                        } else {\r
                                okButton.Image = null;\r