lz4tools icon indicating copy to clipboard operation
lz4tools copied to clipboard

How can i compress xamarin DLL files using lz4?

Open flex0geek opened this issue 3 years ago • 1 comments

I have a xamarin application and its files are compressed using lz4 I could easily decompress the files it using lz4.block.decompress but I couldn't compress it again, can anyone help me with that?

I used the following script to decompress the file and I could read the content of the DLL file but when I modified something and try to recompress it again to patch the APK file I couldn't compress the file in the right format.

with open(input_filepath, "rb") as xalz_file:
    data = xalz_file
    header = data.read(8)
    if header[:4] != b"XALZ":
        sys.exit("The input file does not contain the expected magic bytes, aborting ...")

    payload = data.read()
    decompressed = lz4.block.decompress(payload)
            
    with open(output_filepath, "wb") as output_file:
        output_file.write(decompressed)
        output_file.close()
    print("result written to file")

Note that I couldn't decompress or compress the DLL file using lz4tools.

flex0geek avatar Jul 10 '22 08:07 flex0geek

xamarin apks use lz4 compress as shown here https://github.com/xamarin/xamarin-android/pull/4686

flex0geek avatar Jul 10 '22 08:07 flex0geek