Ejemplo n.º 1
0
        public void DoNotCompress()
        {
            CheckDispose();

            LibENet.HostCompress(Pointer, (Native.ENetCompressor *)IntPtr.Zero);
            Compressor = null;
        }
Ejemplo n.º 2
0
        public void CompressWith(ENetCompressor compressor)
        {
            CheckDispose();
            if (compressor.Host != null && compressor.Host != this)
            {
                throw new Exception("Compressor is already in use by another host.");
            }

            compressor.Host = this;
            Native.ENetCompressor native = new Native.ENetCompressor();
            native.Context    = compressor.AllocHandle();
            native.Compress   = Marshal.GetFunctionPointerForDelegate(ENetCompressor.CompressDelegate);
            native.Decompress = Marshal.GetFunctionPointerForDelegate(ENetCompressor.DecompressDelegate);
            native.Destroy    = Marshal.GetFunctionPointerForDelegate(ENetCompressor.DestroyDelegate);
            LibENet.HostCompress(Pointer, &native);
            Compressor = compressor;
        }