diff --git a/Confuser.Core/Services/CompressionService.cs b/Confuser.Core/Services/CompressionService.cs
index 8ef442481..f3dcba40d 100644
--- a/Confuser.Core/Services/CompressionService.cs
+++ b/Confuser.Core/Services/CompressionService.cs
@@ -22,6 +22,17 @@ public CompressionService(ConfuserContext context) {
this.context = context;
}
+ ///
+ public MethodDef TryGetRuntimeDecompressor(ModuleDef module, Action init) {
+ var decompressor = context.Annotations.Get>>(module, Decompressor);
+ if (decompressor == null)
+ return null;
+
+ foreach (IDnlibDef member in decompressor.Item2)
+ init(member);
+ return decompressor.Item1;
+ }
+
///
public MethodDef GetRuntimeDecompressor(ModuleDef module, Action init) {
Tuple> decompressor = context.Annotations.GetOrCreate(module, Decompressor, m => {
@@ -123,6 +134,17 @@ public void SetProgress(long inSize, long outSize) {
///
public interface ICompressionService {
+ ///
+ /// Gets the runtime decompression method in the module, or null if it's not yet injected.
+ ///
+ /// The module which the decompression method resides in.
+ /// The initializing method for compression helper definitions.
+ ///
+ /// The requested decompression method with signature 'static Byte[] (Byte[])',
+ /// or null if it hasn't been injected yet.
+ ///
+ MethodDef TryGetRuntimeDecompressor(ModuleDef module, Action init);
+
///
/// Gets the runtime decompression method in the module and inject if it does not exists.
///