Skip to content

Commit

Permalink
Fix decompression issue
Browse files Browse the repository at this point in the history
  • Loading branch information
dr4k0nia committed Oct 22, 2021
1 parent 3e51ec5 commit 7297e70
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 5 deletions.
4 changes: 2 additions & 2 deletions Extensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,14 @@ public static string GetOutputPath(this ModuleDefinition module)
@$"{module.Assembly.Name}-decompressed-resources\");
}

public static void Decompress(this byte[] data)
public static byte[] Decompress(this byte[] data)
{
using var input = new MemoryStream(data);
using var output = new MemoryStream();
using var deflateStream = new DeflateStream(input, CompressionMode.Decompress);
deflateStream.CopyTo(output);

output.ToArray();
return output.ToArray();
}

public static void ProcessCompressedFile(this string inputFile)
Expand Down
4 changes: 1 addition & 3 deletions Extractor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -53,10 +53,8 @@ private bool ExtractResources(out Dictionary<byte[], string> resources)

byte[] data = resource.GetData();

data.Decompress();

if (data != null)
resources.Add(data, name);
resources.Add(data.Decompress(), name);

Logger.Success($"Extracted costura resource {name}");
}
Expand Down

0 comments on commit 7297e70

Please sign in to comment.