Exemplo n.º 1
0
        internal Inflater(object inflaterInstance)
        {
            Type type = inflaterInstance.GetType();

            setInputMethod = (SetInputDelegate)Delegate.CreateDelegate(
                typeof(SetInputDelegate),
                inflaterInstance,
                type.GetMethod("SetInput", new Type[] { typeof(byte[]) }));

            getIsFinishedMethod = (GetIsFinishedDelegate)Delegate.CreateDelegate(
                typeof(GetIsFinishedDelegate),
                inflaterInstance,
                type.GetMethod("get_IsFinished", Type.EmptyTypes));

            inflateMethod = (InflateDelegate)Delegate.CreateDelegate(
                typeof(InflateDelegate),
                inflaterInstance,
                type.GetMethod("Inflate", new Type[] { typeof(byte[]) }));

            resetMethod = (ResetDelegate)Delegate.CreateDelegate(
                typeof(ResetDelegate),
                inflaterInstance,
                type.GetMethod("Reset", Type.EmptyTypes));

            setInput3Method = (SetInputDelegate3)Delegate.CreateDelegate(
                typeof(SetInputDelegate3),
                inflaterInstance,
                type.GetMethod("SetInput", new Type[] { typeof(byte[]), typeof(int), typeof(int) }));

            inflate3Method = (InflateDelegate3)Delegate.CreateDelegate(
                typeof(InflateDelegate3),
                inflaterInstance,
                type.GetMethod("Inflate", new Type[] { typeof(byte[]), typeof(int), typeof(int) }));
        }
Exemplo n.º 2
0
                private static void InitDelegates()
                {
                    Contract.Assert(null != ZLibStreamHandle.zlibLibraryHandle);
                    Contract.Assert(!ZLibStreamHandle.zlibLibraryHandle.IsInvalid);

                    deflateInit2_Delegate = CreateDelegate <DeflateInit2_Delegate>("deflateInit2_");

                    deflateDelegate = CreateDelegate <DeflateDelegate>("deflate");

                    deflateEndDelegate = CreateDelegate <DeflateEndDelegate>("deflateEnd");

                    inflateInit2_Delegate = CreateDelegate <InflateInit2_Delegate>("inflateInit2_");

                    inflateDelegate = CreateDelegate <InflateDelegate>("inflate");

                    inflateEndDelegate = CreateDelegate <InflateEndDelegate>("inflateEnd");

                    zlibCompileFlagsDelegate = CreateDelegate <ZlibCompileFlagsDelegate>("zlibCompileFlags");

#if !SILVERLIGHT
                    RuntimeHelpers.PrepareDelegate(deflateInit2_Delegate);
                    RuntimeHelpers.PrepareDelegate(deflateDelegate);
                    RuntimeHelpers.PrepareDelegate(deflateEndDelegate);
                    RuntimeHelpers.PrepareDelegate(inflateInit2_Delegate);
                    RuntimeHelpers.PrepareDelegate(inflateDelegate);
                    RuntimeHelpers.PrepareDelegate(inflateEndDelegate);
                    RuntimeHelpers.PrepareDelegate(zlibCompileFlagsDelegate);
#endif // !SILVERLIGHT
                }
Exemplo n.º 3
0
        internal Inflater(object inflaterInstance)
        {
            Type type = inflaterInstance.GetType();

            setInputMethod = (SetInputDelegate)Delegate.CreateDelegate(
                typeof(SetInputDelegate),
                inflaterInstance,
                type.GetMethod("SetInput", new Type[] { typeof(byte[]) }));

            getIsFinishedMethod = (GetIsFinishedDelegate)Delegate.CreateDelegate(
                typeof(GetIsFinishedDelegate),
                inflaterInstance,
                type.GetMethod("get_IsFinished", Type.EmptyTypes));

            inflateMethod = (InflateDelegate)Delegate.CreateDelegate(
                typeof(InflateDelegate),
                inflaterInstance,
                type.GetMethod("Inflate", new Type[] { typeof(byte[]) }));

            resetMethod = (ResetDelegate)Delegate.CreateDelegate(
                typeof(ResetDelegate),
                inflaterInstance,
                type.GetMethod("Reset", Type.EmptyTypes));

            setInput3Method = (SetInputDelegate3)Delegate.CreateDelegate(
                typeof(SetInputDelegate3),
                inflaterInstance,
                type.GetMethod("SetInput", new Type[] { typeof(byte[]), typeof(int), typeof(int) }));

            inflate3Method = (InflateDelegate3)Delegate.CreateDelegate(
                typeof(InflateDelegate3),
                inflaterInstance,
                type.GetMethod("Inflate", new Type[] { typeof(byte[]), typeof(int), typeof(int) }));
        }