LIB_REFS = System System.Xml
LIB_MCS_FLAGS = -unsafe
TEST_MCS_FLAGS = -unsafe
-TEST_LIB_REFS = WindowsBase System System.Xml System.Core
+TEST_LIB_REFS = WindowsBase System System.Xml System.Core System.IO.Compression
ifeq (2.0, $(FRAMEWORK_VERSION))
LIB_MCS_FLAGS += -d:NET_3_0
using System;\r
using System.Collections.Generic;\r
using System.IO;\r
+using System.IO.Compression;\r
using System.IO.Packaging;\r
using System.Linq;\r
using System.Text;\r
package = Package.Open (path);\r
package.Close ();\r
package = Package.Open (path);\r
- }\r
+ } \r
\r
[Test]\r
public void Close_FileStreamNotClosed ()\r
File.Create (path).Close ();\r
package = Package.Open (path, FileMode.OpenOrCreate, FileAccess.Write);\r
}\r
+\r
+ [Test]\r
+ public void Check_ZipDateTime ()\r
+ {\r
+ using (var zipStream = new FileStream (path, FileMode.OpenOrCreate, FileAccess.ReadWrite))\r
+ using (package = Package.Open (zipStream, FileMode.OpenOrCreate)) {\r
+ var part = package.CreatePart (new Uri ("/test", UriKind.Relative), "test/type");\r
+ using (var stream = part.GetStream ())\r
+ stream.Write (new byte [1024 * 1024], 0, 1024 * 1024);\r
+ }\r
+\r
+ using (var stream = new FileStream (path, FileMode.Open, FileAccess.Read))\r
+ using (var archive = new ZipArchive(stream))\r
+ { \r
+ foreach (var entry in archive.Entries)\r
+ Assert.AreEqual (entry.LastWriteTime.Year, DateTime.Now.Year);\r
+ }\r
+ } \r
}\r
}\r
//
using System;
+using System.Runtime.InteropServices;
namespace zipsharp
{
+ [StructLayoutAttribute (LayoutKind.Sequential)]
struct ZipFileInfo
{
ZipTime date;
public ZipFileInfo (DateTime fileTime)
{
date = new ZipTime (fileTime);
- dosDate = new IntPtr ((int)fileTime.ToFileTime ());
+ dosDate = IntPtr.Zero;
internalFileAttributes = IntPtr.Zero;
externalFileAttributes = IntPtr.Zero;
}