Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6888443
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T06:01:00+00:00 2026-05-27T06:01:00+00:00

I downloaded the SDK 7zip from here . Then I used this code to

  • 0

I downloaded the SDK 7zip from here.

Then I used this code to compress a file to 7zip:

private static void CompressFileLZMA(string inFile, string outFile)
{
    Encoder coder = new SevenZip.Compression.LZMA.Encoder();

    using (FileStream input = new FileStream(inFile, FileMode.Open))
    using (FileStream output = new FileStream(outFile, FileMode.Create))
    {
        coder.Code(input, output, -1, -1, null);
        output.Flush();
    }
}

I tried both the SDK versions 9.20 and 9.22 beta on the site.

The compression seems working to compress my file from: 1.6 MB to 239 KB.

However, if I use WinRar or 7zip to decompress. the archive file is not recognized by them, the error is like

“unknown archive file or damaged file”

Any idea for this?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T06:01:01+00:00Added an answer on May 27, 2026 at 6:01 am

    You can try to use 7zSharp wrapper or at least analyze wrappers code how everything is done.

    Code to compress file(taken from 7zSharp):

      public void EncodeSingleFile(string inFile, string outFile)
      {
         using (FileStream inStream = new FileStream(inFile, FileMode.Open, FileAccess.Read))
         {
            using (FileStream outStream = new FileStream(outFile, FileMode.OpenOrCreate, FileAccess.Write))
            {
               EncodeSingleFile(inStream, outStream);
            }
         }
      }
    
      public void EncodeSingleFile(FileStream inStream, FileStream outStream)
      {
         bool eos = false;
         Int32 dictionary = 1 << 21;
         Int32 posStateBits = 2;
         Int32 litContextBits = 3; // for normal files
         // UInt32 litContextBits = 0; // for 32-bit data
         Int32 litPosBits = 0;
         // UInt32 litPosBits = 2; // for 32-bit data
         Int32 algorithm = 2;
         Int32 numFastBytes = 128;
         string mf = "bt4";
    
         propIDs = new CoderPropID[]
            {
               CoderPropID.DictionarySize,
               CoderPropID.PosStateBits,
               CoderPropID.LitContextBits,
               CoderPropID.LitPosBits,
               CoderPropID.Algorithm,
               CoderPropID.NumFastBytes,
               CoderPropID.MatchFinder,
               CoderPropID.EndMarker
            };
         properties = new object[]
            {
               dictionary,
               posStateBits,
               litContextBits,
               litPosBits,
               algorithm,
               numFastBytes,
               mf,
               eos
            };
    
         Encoder encoder = new Encoder();
         encoder.SetCoderProperties(propIDs, properties);
         encoder.WriteCoderProperties(outStream);
         Int64 fileSize = inStream.Length;
         for (int i = 0; i < 8; i++)
         {
            outStream.WriteByte((Byte) (fileSize >> (8*i)));
         }
         encoder.Code(inStream, outStream, -1, -1, null);
      }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Where is FBSession.h in the Facebook SDK downloaded from here: https://github.com/facebook/facebook-ios-sdk ? I've also
Downloaded IOS5 SDK yesterday, and this code which I use to set my UIToolbar's
I downloaded Android SDK components from http://dl-ssl.google.com/android/repository/repository.xml . Now my question is how to
I have downloaded Qt SDK (with the libraries) for Linux from the Qt website.
Just downloaded the new Kinect SDK Beta from Microsoft and am really excited to
After I downloaded meego sdk 1.2 from http://developer.meego.com/meego-sdk , the installation failed with the
I downloaded iPhone SDK 3.1 with Xcode 3.2 for Snow Leopard from Apple, but
I've downloaded flex SDK from adobe.com. When I call mxmlc or compc russian symbols
Just downloaded AMD-APP-SDK-v2.5-RC2-lnx32 , why i got this: GPU not found. , when i
I'm starting android development from just three days, I have downloaded the SDK and

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.