LzmaStream produce 7-zip incompatible output #227

Closed
opened 2026-01-29 22:08:41 +00:00 by claunia · 2 comments
Owner

Originally created by @dimzon on GitHub (Aug 17, 2017).

            var dictionarySize = 16 * 1024 * 1024;
            using (var fs = File.OpenRead(inputFilePath))
            using (var ofs = File.Create(inputFilePath+".lzma"))
            using (var lz = new LzmaStream(new LzmaEncoderProperties(false, dictionarySize, 256), false, ofs))
            // http://sevenzipsharp.codeplex.com/ - works fine !
            // using (var lz = new LzmaEncodeStream(ofs, dictionarySize))
                fs.CopyTo(lz);

7-zip (latest version) can't open *.lzma files produced by SharpCompress
same files produced by SevenZipSharp works fine

Originally created by @dimzon on GitHub (Aug 17, 2017). ``` var dictionarySize = 16 * 1024 * 1024; using (var fs = File.OpenRead(inputFilePath)) using (var ofs = File.Create(inputFilePath+".lzma")) using (var lz = new LzmaStream(new LzmaEncoderProperties(false, dictionarySize, 256), false, ofs)) // http://sevenzipsharp.codeplex.com/ - works fine ! // using (var lz = new LzmaEncodeStream(ofs, dictionarySize)) fs.CopyTo(lz); ``` 7-zip (latest version) can't open *.lzma files produced by SharpCompress same files produced by SevenZipSharp works fine
claunia added the question label 2026-01-29 22:08:41 +00:00
Author
Owner

@adamhathcock commented on GitHub (Aug 17, 2017):

If that is making a file with this format: https://svn.python.org/projects/external/xz-5.0.3/doc/lzma-file-format.txt
Then SharpCompress isn't attempting to make that with an LzmaStream It is making a raw LZMA stream with that

Proper lzma format could be added easily it seems.

@adamhathcock commented on GitHub (Aug 17, 2017): If that is making a file with this format: https://svn.python.org/projects/external/xz-5.0.3/doc/lzma-file-format.txt Then SharpCompress isn't attempting to make that with an `LzmaStream` It is making a raw LZMA stream with that Proper lzma format could be added easily it seems.
Author
Owner

@dimzon commented on GitHub (Aug 17, 2017):

            var dictionarySize = 16 * 1024 * 1024;
            using (var fs = File.OpenRead(inputFilePath))
            using (var ofs = File.Create(outputFilePath))
            using (var lz = new LzmaStream(new LzmaEncoderProperties(true, dictionarySize, 256), false, ofs))
            {
                ofs.Write(lz.Properties,0,lz.Properties.Length);
                for(var i=0;i<8;++i) ofs.WriteByte(255);
                fs.CopyTo(lz);
            }

this one works fine
please add to FAQ.

@dimzon commented on GitHub (Aug 17, 2017): ``` var dictionarySize = 16 * 1024 * 1024; using (var fs = File.OpenRead(inputFilePath)) using (var ofs = File.Create(outputFilePath)) using (var lz = new LzmaStream(new LzmaEncoderProperties(true, dictionarySize, 256), false, ofs)) { ofs.Write(lz.Properties,0,lz.Properties.Length); for(var i=0;i<8;++i) ofs.WriteByte(255); fs.CopyTo(lz); } ``` this one works fine please add to FAQ.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/sharpcompress#227