internal static ZipEntry Create(String filename, string DirectoryPathInArchive)
{
ZipEntry entry = new ZipEntry();
entry._LocalFileName = filename;
if (DirectoryPathInArchive == null)
entry._FileNameInArchive = filename;
else
{
// explicitly specify a pathname for this file
entry._FileNameInArchive =
System.IO.Path.Combine(DirectoryPathInArchive, System.IO.Path.GetFileName(filename));
}
entry._LastModified = System.IO.File.GetLastWriteTime(filename);
// adjust the time if the .NET BCL thinks it is in DST.
// see the note elsewhere in this file for more info.
if (entry._LastModified.IsDaylightSavingTime())
{
System.DateTime AdjustedTime = entry._LastModified - new System.TimeSpan(1, 0, 0);
entry._LastModDateTime = ZForge.Zip.Shared.DateTimeToPacked(AdjustedTime);
}
else
entry._LastModDateTime = ZForge.Zip.Shared.DateTimeToPacked(entry._LastModified);
// we don't actually slurp in the file until the caller invokes Write on this entry.
return entry;
}