using System; namespace ScreenConnect; public class ZStandardDecoder : ZStandardCoder { public static int MaximumReasonableWindowLog => 30; public override bool AreInputOutputCursorsAlwaysSynced => true; protected override (Native.libzstd.ZSTD_dParameter, int)[] GetParameterValues() { return new(Native.libzstd.ZSTD_dParameter, int)[1] { (Native.libzstd.ZSTD_dParameter.ZSTD_d_windowLogMax, MaximumReasonableWindowLog) }; } protected override IntPtr CreateStream() { return NativeLibrarySingleton.Instance.ZSTD_createDStream(); } protected override IntPtr InitializeStream(IntPtr stream) { return NativeLibrarySingleton.Instance.ZSTD_initDStream(stream); } protected override IntPtr FreeStream(IntPtr stream) { return NativeLibrarySingleton.Instance.ZSTD_freeDStream(stream); } protected override IntPtr SetParameterValue(IntPtr stream, Native.libzstd.ZSTD_dParameter parameter, int value) { return NativeLibrarySingleton.Instance.ZSTD_DCtx_setParameter(stream, parameter, value); } protected override IntPtr GetInputSize() { return NativeLibrarySingleton.Instance.ZSTD_DStreamInSize(); } protected override IntPtr GetOutputSize() { return NativeLibrarySingleton.Instance.ZSTD_DStreamOutSize(); } protected override IntPtr Process(IntPtr stream, ref Native.libzstd.ZSTD_Buffer input, ref Native.libzstd.ZSTD_Buffer output, CoderFlushType flushType) { return NativeLibrarySingleton.Instance.ZSTD_decompressStream(stream, ref output, ref input); } public override IntPtr GetCurrentSize(IntPtr stream) { return NativeLibrarySingleton.Instance.ZSTD_sizeof_DCtx(stream); } }