diff --git a/SabreTools.Compression/zlib/zlibConst.cs b/SabreTools.Compression/zlib/zlibConst.cs
index 244b47a..f15f6af 100644
--- a/SabreTools.Compression/zlib/zlibConst.cs
+++ b/SabreTools.Compression/zlib/zlibConst.cs
@@ -19,5 +19,29 @@ namespace SabreTools.Compression.zlib
public const int Z_MEM_ERROR = (-4);
public const int Z_BUF_ERROR = (-5);
public const int Z_VERSION_ERROR = (-6);
+
+ ///
+ /// Get the zlib result name from an integer
+ ///
+ /// Integer to translate to the result name
+ /// Name of the result, the integer as a string otherwise
+ public static string ToZlibConstName(this int result)
+ {
+ return result switch
+ {
+ 0 => "Z_OK",
+ 1 => "Z_STREAM_END",
+ 2 => "Z_NEED_DICT",
+
+ -1 => "Z_ERRNO",
+ -2 => "Z_STREAM_ERROR",
+ -3 => "Z_DATA_ERROR",
+ -4 => "Z_MEM_ERROR",
+ -5 => "Z_BUF_ERROR",
+ -6 => "Z_VERSION_ERROR",
+
+ _ => result.ToString(),
+ };
+ }
}
}
\ No newline at end of file