ZForge.Zip.ZipEntry.Create C# (CSharp) Method

Create() static private method

static private Create ( String filename, string DirectoryPathInArchive ) : ZipEntry
filename String
DirectoryPathInArchive string
return ZipEntry
        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;
        }

Same methods

ZipEntry::Create ( String filename ) : ZipEntry

Usage Example

Exemplo n.º 1
0
 internal static ZipEntry Create(String filename)
 {
     return(ZipEntry.Create(filename, null));
 }