Home Forums .NET libraries Xceed Zip & Real-Time Zip for .NET Wrong LastModifiedTime in Zipped Files

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • User (Old forums)
    Member
    Post count: 23064
    #20540 |

    im using the method CompressFiles that is described below

    and except one problem it works well.

    zipped files inside the created zip file creation time is always 00:00 ? (the date is correct)

    see attached file

          public static void CompressFiles(string sourceFolder, IEnumerable<string> files, string zipFilename)

            {

                var output = new FileStream(zipFilename, FileMode.Create);

                using (var zipWriter = new ZipWriter(output))

                {

                    // create a local header object

                    var localHeader = new ZipItemLocalHeader

                    {

                        EncryptionPassword = null,

                        CompressionLevel = CompressionLevel.Highest,

                        CompressionMethod = CompressionMethod.Deflated

                    };

                    // write files

                    var buffer = new byte[256*1024];

                    foreach (var file in files)

                    {

                        string  fullpath = Path.GetFullPath(sourceFolder);

                        localHeader.FileName = file.Substring(fullpath.Count(), file.Length – fullpath.Count());

                        zipWriter.WriteItemLocalHeader(localHeader);

                        

                        // write file                    

                        using (var fileStream = new FileStream(file, FileMode.Open))

                        {

                            zipWriter.WriteItemData(fileStream, buffer, 0, buffer.Length);

                        }

                    }

                    zipWriter.CloseZipFile();

                }

            } 

    Imported from legacy forums. Posted by Aviv (had 604 views)

    Diane [Xceed]
    Moderator
    Post count: 1353

    Hi Aviv,

    The Xceed Real-Time Zip component does not currently allow setting the last write date/time for zipped items. So it automatically assigns the current date and time 00:00 to zipped items. This is by design.

    However, we have changed this behavior and added the ability for you to set your own last write date time.

    In the next version of the component (v5.6), the new LastWriteDateTime property found in the ZipItemLocalHeader will add this flexibility.

    The default value will still be DateTime.Today at 00:00 hours, but you will be able to change that if you wish. For example, you could set the value to the actual last write date time of the source file you are zipping.

    Version 5.6 is currently planned for release next week.

    Imported from legacy forums. Posted by Diane [Xceed] (had 270 views)

    User (Old forums)
    Member
    Post count: 23064

    Hi Diane,

    Please provide exact date for the patch release,

    I need this feature urgently. 

    please notice I use the .net 3.5 version of the component. Xceed.Zip.NET.4.7.14418.0

    in your post you said that version 5.6 will contain this feature. this is the .net4.0 version if im not mistaken.

     

    Imported from legacy forums. Posted by Aviv (had 173 views)

    Diane [Xceed]
    Moderator
    Post count: 1353

    Hi Aviv,

    The new release should be online sometime today. You can subscribe to the RSS feed of the Updates Center page to be notified when it is modified.

    Updates Center: http://www.xceed.com/updates

    Version 5.6 is indeed for .NET 4/4.5. For .NET 3.5, you will want to use the new v4.8 instead which will be release at the same time as v5.6.

    Imported from legacy forums. Posted by Diane [Xceed] (had 701 views)

Viewing 4 posts - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.