OSDN Git Service

Merge branch 'master' of git.sourceforge.jp:/gitroot/applistation/AppliStation.git
authorttp <ttp@users.sourceforge.jp>
Fri, 8 Oct 2010 15:50:04 +0000 (00:50 +0900)
committerttp <ttp@users.sourceforge.jp>
Fri, 8 Oct 2010 15:50:04 +0000 (00:50 +0900)
na-get-lib/NaGet.Packages.Install/UninstallInformation.cs

index d6c9adc..82cfbaf 100644 (file)
@@ -92,13 +92,19 @@ namespace NaGet.Packages.Install
                public string InstallDateString {\r
                        get { return (InstallDate != null)? InstallDate.Value.ToString("yyyyMMdd") : null; }\r
                        set {\r
-                               if (value == null) {\r
+                               if ((! string.IsNullOrEmpty(value)) && \r
+                                   System.Text.RegularExpressions.Regex.IsMatch(value, @"^[0-9]{8}$")) {\r
+                                       try {\r
+                                               InstallDate = new DateTime(\r
+                                                       int.Parse(value.Substring(0,4)),\r
+                                                       int.Parse(value.Substring(4,2)),\r
+                                                       int.Parse(value.Substring(6,2))\r
+                                               );\r
+                                       } catch (Exception) {\r
+                                       }\r
+                               } else {\r
                                        InstallDate = null;\r
-                               } else if (System.Text.RegularExpressions.Regex.IsMatch(value, @"^[0-9]{8}$")) {\r
-                                       InstallDate = new DateTime(int.Parse(value.Substring(0,4)),\r
-                                                                  int.Parse(value.Substring(4,2)),\r
-                                                                  int.Parse(value.Substring(6,2)));\r
-                               } else throw new ArgumentException("Does not match date format (YYYYMMDD)");\r
+                               }\r
                        }\r
                }\r
                \r