OSDN Git Service

na-get-lib,ダウンロードしたファイルの更新日時をWebリソースのそれと合わせるように
authorttp <ttp@users.sourceforge.jp>
Wed, 27 Feb 2008 04:13:12 +0000 (04:13 +0000)
committerttp <ttp@users.sourceforge.jp>
Wed, 27 Feb 2008 04:13:12 +0000 (04:13 +0000)
git-svn-id: http://localhost/svn/AppliStation/trunk@857 34ed2c89-c49f-4a4b-abdb-c318350108cf

na-get-lib/NaGet.Net/Downloader.cs

index a38f76b..926f947 100644 (file)
@@ -198,8 +198,6 @@ public class Downloader : NaGetTask
                                                while ((size = stream.Read(data,0,data.Length)) > 0) {\r
                                                        fs.Write(data, 0, size);\r
                                                        \r
                                                while ((size = stream.Read(data,0,data.Length)) > 0) {\r
                                                        fs.Write(data, 0, size);\r
                                                        \r
-                                                       bool hoge = cancelCalled;\r
-                                                       \r
                                                        if (cancelCalled) {\r
                                                                throw new NaGetTaskCanceledException(string.Empty);\r
                                                        }\r
                                                        if (cancelCalled) {\r
                                                                throw new NaGetTaskCanceledException(string.Empty);\r
                                                        }\r
@@ -225,6 +223,15 @@ public class Downloader : NaGetTask
                                        }\r
                                }\r
                        }\r
                                        }\r
                                }\r
                        }\r
+                       \r
+                       // 更新日を補完\r
+                       if (File.Exists(filepath)) {\r
+                               if (response is HttpWebResponse) {\r
+                                       File.SetLastWriteTime(filepath, ((HttpWebResponse) response).LastModified);\r
+                               } else if (response is FtpWebResponse) {\r
+                                       File.SetLastWriteTime(filepath, ((FtpWebResponse) response).LastModified);\r
+                               }\r
+                       }\r
                } finally {\r
                        if (response != null) {\r
                                response.Close();\r
                } finally {\r
                        if (response != null) {\r
                                response.Close();\r