I am using 7zip sdk (http://www.7-zip.org/sdk.html) to compress the file.
it works fine with this shell:
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);
}
However, I have a problem:
I can only unzip it using the 7zip shell installed from 7-zip.org, cannot unzip it with unrar. is it possible if I set some parameters and it will work with unrar too?
If I open the file in 7zip and check the properties, I got:
- Name: abc.pdb
- Size: 1 809 920
- Package Size: 249,305
- Method: LZMA: 21
- Type: lzma
source share