-2

I am trying to decompress an LZMA bytes but it isn't really documented which sucks when I tried to decompress the bytes using a method I have seen in source code I got data error, I think the data error is due to dictionary size setting dictionary size for decoder is private only this method edits dictionary size

public void SetDecoderProperties(byte[] properties)
{
    if (properties.Length < 5)
    {
        throw new InvalidParamException();
    }
    int lc = (int)(properties[0] % 9);
    int num = (int)(properties[0] / 9);
    int lp = num % 5;
    int num2 = num / 5;
    if (num2 > 4)
    {
        throw new InvalidParamException();
    }
    uint num3 = 0U;
    for (int i = 0; i < 4; i++)
    {
        num3 += (uint)((uint)properties[1 + i] << i * 8);
    }
    this.SetDictionarySize(num3);
    this.SetLiteralProperties(lp, lc);
    this.SetPosBitsProperties(num2);
}

I don't think it is private to make it harder to use so there must be a reason why it asks for bytes instead of size of dictionary in int but I am confused how to use this any help on how to use this?

  • 7-Zip provides an open source (public domain actually) C# SDK for LZMA which might be useful to you (haven't ever used it). Link: https://www.7-zip.org/sdk.html – Joelius May 07 '21 at 21:05
  • @Joelius the problem is in using it – CrazyGrandman May 07 '21 at 21:22
  • Why do you thing the error is due to dictionary size? It is almost certainly because the data has been somehow modified/corrupted since it came from the LZMA compressor, has extra header information added or removed, came from an incompatible version, etc. – Ben Voigt May 07 '21 at 22:38
  • @BenVoigt you are right, it is no from dictionary size thanks – CrazyGrandman May 08 '21 at 09:06

0 Answers0