Zip file with eliminating timestamp

Sep 22, 2013 at 6:36 AM
Hi all,

I am using the following code to zip a file. this is for mimetype of epub file. When i check the file in epub validator, it shows the error "Mimetype file should contain only the string "application/epub+zip".". So i checked the file using a hex editor and found the mimetype contains the following string.
moreover it should contains 20 byte length and my mimetype is 25 byte length. Additional 3 char at beginning and 2 char at end are added to my string.
Can anyone help me to sort out this issue?
Sep 22, 2013 at 6:39 AM
Following is the code i used

using (MemoryStream ms = new MemoryStream())
        //content of the file is static and is used here directly
        using (StreamWriter w = new StreamWriter(ms, Encoding.UTF8))
        using (ZipFile zip = new ZipFile())
            MemoryStream msMimetype = new MemoryStream(ms.ToArray());
            msMimetype.Seek(0, SeekOrigin.Begin);

            zip.Encryption = Ionic.Zip.EncryptionAlgorithm.None;
            zip.EmitTimesInUnixFormatWhenSaving = false;
            zip.EmitTimesInWindowsFormatWhenSaving = false;                    
            zip.UseZip64WhenSaving = Ionic.Zip.Zip64Option.Never;
            zip.CompressionMethod = Ionic.Zip.CompressionMethod.None;
            zip.CompressionLevel = Ionic.Zlib.CompressionLevel.None;

            zip.AddEntry("mimetype", msMimetype);

            zip.Save(System.IO.Path.GetTempPath() + "\\" + FileName);