A friend of mine gave me the challenge to decompress an assembly that was packed with Fody.Costura. The assembly has a dll dependency that was embedded as a resource. I tried to extract this .zip resource with dotPeek and decompress it with this code here
public static void Decompress(string path)
{
using (var stream = File.OpenRead(path))
using (var compressStream = new DeflateStream(stream, CompressionMode.Decompress))
{
compressStream.Seek(0, SeekOrigin.Begin);
var fs = File.Create(path + ".decompressed");
compressStream.CopyTo(fs);
fs.Close();
}
}
This works when it comes to extracting the .zip but the result is quite unuseful
Is there a suitable solution to decompress this packed dll?
The code that Costura uses to decompress those resources is here.
https://github.com/Fody/Costura/blob/master/src/Costura.Template/Common.cs