OSDN Git Service

AppliStation-GUI,ショートカットファイルが不正(リンク先解決不能状態:持ち運びなどで発生)の際にアンインストールダイアログが開けなくなるバグを修正
authorttp <ttp@users.sourceforge.jp>
Fri, 8 Aug 2008 02:15:54 +0000 (02:15 +0000)
committerttp <ttp@users.sourceforge.jp>
Fri, 8 Aug 2008 02:15:54 +0000 (02:15 +0000)
git-svn-id: http://localhost/svn/AppliStation/trunk@946 34ed2c89-c49f-4a4b-abdb-c318350108cf

AppliStation/AppliStation.Util/GUIUtils.cs

index ce69965..37a98f9 100644 (file)
@@ -33,10 +33,14 @@ namespace AppliStation.Util
                                        string[] lnkFiles = Directory.GetFiles(progGrp, "*.lnk");\r
                                        \r
                                        if (lnkFiles.Length >= 1) {\r
-                                               using (NaGet.InteropServices.ShellLink link = new NaGet.InteropServices.ShellLink(lnkFiles[0])) {\r
-                                                       if (File.Exists(link.GetPath(0))) {\r
-                                                               return Icon.ExtractAssociatedIcon(link.GetPath(0));\r
+                                               try {\r
+                                                       using (NaGet.InteropServices.ShellLink link = new NaGet.InteropServices.ShellLink(lnkFiles[0])) {\r
+                                                               if (File.Exists(link.GetPath(0))) {\r
+                                                                       return Icon.ExtractAssociatedIcon(link.GetPath(0));\r
+                                                               }\r
                                                        }\r
+                                               } catch (System.Runtime.InteropServices.COMException) {\r
+                                                       // ShellLinkのオープンあるいは、リンク先解決に失敗した場合\r
                                                }\r
                                        }\r
                                }\r