Home Forums .NET libraries Xceed Zip & Real-Time Zip for .NET Natively compressed files

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

    Hi,

    I’m new to Xceed Zip… 

    Is it possible to add files to a zip without compressing it when they are natively compressed like jpg’s, mp3’s etc?  Or is it maybe already handled internally?  In my case there should also be compression done for files in the same zip, like txt files, doc’s, xls etc.

     

    Kind Regards,

     

    Anton 

    Imported from legacy forums. Posted by Anton (had 2806 views)

    User (Old forums)
    Member
    Post count: 23064

    Hi Anton,

    I have just performed a test on a set of files using the following lines of code:

    ZipArchive zipArch = new ZipArchive(new DiskFile(@”D:\TestFolder\Target.zip”));
    AbstractFile df1 = new DiskFile(@”D:\TestFolder\Source1.jpg”);
    AbstractFile df2 = new DiskFile(@”D:\TestFolder\Source2.jpg”);
    AbstractFile df3 = new DiskFile(@”D:\TestFolder\Source3.jpg”);
    AbstractFile df4 = new DiskFile(@”D:\TestFolder\Source4.jpg”);

    zipArch.DefaultCompressionMethod = Xceed.Compression.CompressionMethod.Stored;
    df1.CopyTo(zipArch, true);
    zipArch.DefaultCompressionMethod = Xceed.Compression.CompressionMethod.Deflated;
    df2.CopyTo(zipArch, true);
    zipArch.DefaultCompressionMethod = Xceed.Compression.CompressionMethod.Deflated64;
    df3.CopyTo(zipArch, true);
    zipArch.DefaultCompressionMethod = Xceed.Compression.CompressionMethod.BZip2;
    df4.CopyTo(zipArch, true);

    Source1..4.jpg are identical (a 50KB jpg file).

    Source1 is being stored, therefore it is uncompressed.  Source2 ans Source3 were both compressed by 21% even if the jpg is a compressed format using the Deflated (standard Xceed compression) and Deflated64 methods.  The fourth file was compressed by 17% using the BZip2 method.

    Overall, this means that even if the file you are compressing are already in a compressed format (mp3, jpg, etc), in most cases there will be room for improvement. 

     

    Imported from legacy forums. Posted by Ghislain (had 242 views)

    User (Old forums)
    Member
    Post count: 23064

    Thank you Ghislain… will try it now!

    Anton 

    Imported from legacy forums. Posted by Anton (had 1970 views)

    User (Old forums)
    Member
    Post count: 23064

    It seems that I need another ‘using’ or assembly reference for the ‘= CompressionMethod.Stored’ part. I currently just have:

    using Xceed.Zip;

    using Xceed.FileSystem;

    Or am I missing something different entirely?

     Thx,

    Anton 

    Imported from legacy forums. Posted by Anton (had 274 views)

    User (Old forums)
    Member
    Post count: 23064

    Hi again,

    you are perfectly right.  You will find the “CompressionMethod” enum in Xceed.Compression.dll

     

    Imported from legacy forums. Posted by Ghislain (had 1781 views)

    User (Old forums)
    Member
    Post count: 23064

    Thanx a million!

    Imported from legacy forums. Posted by Anton (had 3143 views)

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