code_junkie

How do I create 7-Zip archives with .NET?

Nov 11th, 2011
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.43 KB | None | 0 0
  1. using SevenZip.Compression.LZMA;
  2. private static void CompressFileLZMA(string inFile, string outFile)
  3. {
  4. SevenZip.Compression.LZMA.Encoder coder = new SevenZip.Compression.LZMA.Encoder();
  5.  
  6. using (FileStream input = new FileStream(inFile, FileMode.Open))
  7. {
  8. using (FileStream output = new FileStream(outFile, FileMode.Create))
  9. {
  10. coder.Code(input, output, -1, -1, null);
  11. output.Flush();
  12. }
  13. }
  14. }
Add Comment
Please, Sign In to add comment