Esempio n. 1
0
            public ErrorCode Inflate(FlushCode flush)
            {
                EnsureNotDisposed();
                EnsureState(State.InitializedForInflate);

                return(NativeZLibDLLStub.inflateDelegate(zStreamPtr, flush));
            }
Esempio n. 2
0
            public ErrorCode Deflate(FlushCode flush)
            {
                EnsureNotDisposed();
                EnsureState(State.InitializedForDeflate);

                return(NativeZLibDLLStub.deflateDelegate(ref zStream, flush));
            }
Esempio n. 3
0
            public ErrorCode DeflateEnd()
            {
                EnsureNotDisposed();
                EnsureState(State.InitializedForDeflate);

                ErrorCode errC;

#if !FEATURE_NETCORE
                RuntimeHelpers.PrepareConstrainedRegions();
#endif
                try { } finally {
                    errC = NativeZLibDLLStub.deflateEndDelegate(zStreamPtr);
                    initializationState = State.Disposed;
                    zlibLibraryHandle.DangerousRelease();
                }
                return(errC);
            }
Esempio n. 4
0
            public ErrorCode InflateInit2_(int windowBits)
            {
                EnsureNotDisposed();
                EnsureState(State.NotInitialized);

                ErrorCode errC;
                bool      addRefSuccess = false;

#if !FEATURE_NETCORE
                RuntimeHelpers.PrepareConstrainedRegions();
#endif
                try { } finally {
                    errC = NativeZLibDLLStub.inflateInit2_Delegate(zStreamPtr, windowBits, ZLibVersion, sizeof(ZStream));

                    initializationState = State.InitializedForInflate;
                    zlibLibraryHandle.DangerousAddRef(ref addRefSuccess);
                }

                Contract.Assert(addRefSuccess, "zlibLibraryHandle.DangerousAddRef in InflateInit2_ should always succeed, but it did not.");

                return(errC);
            }
Esempio n. 5
0
            public ErrorCode DeflateInit2_(CompressionLevel level, int windowBits, int memLevel, CompressionStrategy strategy)
            {
                EnsureNotDisposed();
                EnsureState(State.NotInitialized);

                ErrorCode errC;
                bool      addRefSuccess = false;

#if !FEATURE_NETCORE
                RuntimeHelpers.PrepareConstrainedRegions();
#endif
                try { } finally {
                    errC = NativeZLibDLLStub.deflateInit2_Delegate(ref zStream, level, CompressionMethod.Deflated, windowBits, memLevel,
                                                                   strategy, ZLibVersion, Marshal.SizeOf(zStream));
                    initializationState = State.InitializedForDeflate;
                    zlibLibraryHandle.DangerousAddRef(ref addRefSuccess);
                }

                Contract.Assert(addRefSuccess, "zlibLibraryHandle.DangerousAddRef in DeflateInit2_ should always succeed, but it did not.");

                return(errC);
            }
Esempio n. 6
0
 internal static Int32 ZLibCompileFlags()
 {
     return(NativeZLibDLLStub.zlibCompileFlagsDelegate());
 }