Exemple #1
0
        public Serializer()
        {
            _allocate               = new AllocateUnmanagedDelegate(AllocateUnmanaged);
            _finalizeChunk          = new FinalizeChunkUnmanagedDelegate(FinalizeChunk);
            _findNameForPointer     = new FindNameForPointerUnmanagedDelegate(FindNameForPointer);
            _findPointer            = new FindPointerUnmanagedDelegate(FindPointer);
            _finishSerialization    = new FinishSerializationUnmanagedDelegate(FinishSerialization);
            _getBufferPointer       = new GetBufferPointerUnmanagedDelegate(GetBufferPointer);
            _getChunk               = new GetChunkUnmanagedDelegate(GetChunk);
            _getCurrentBufferSize   = new GetCurrentBufferSizeUnmanagedDelegate(GetCurrentBufferSize);
            _getNumChunks           = new GetNumChunksUnmanagedDelegate(GetNumChunks);
            _getSerializationFlags  = new GetSerializationFlagsUnmanagedDelegate(GetSerializationFlags);
            _getuniquePointer       = new GetUniquePointerUnmanagedDelegate(GetUniquePointer);
            _registernameForPointer = new RegisterNameForPointerUnmanagedDelegate(RegisterNameForPointer);
            _serializeName          = new SerializeNameUnmanagedDelegate(SerializeName);
            _setSerializationFlags  = new SetSerializationFlagsUnmanagedDelegate(SetSerializationFlags);
            _startSerialization     = new StartSerializationUnmanagedDelegate(StartSerialization);

            _native = btSerializerWrapper_new(
                Marshal.GetFunctionPointerForDelegate(_allocate),
                Marshal.GetFunctionPointerForDelegate(_finalizeChunk),
                Marshal.GetFunctionPointerForDelegate(_findNameForPointer),
                Marshal.GetFunctionPointerForDelegate(_findPointer),
                Marshal.GetFunctionPointerForDelegate(_finishSerialization),
                Marshal.GetFunctionPointerForDelegate(_getBufferPointer),
                Marshal.GetFunctionPointerForDelegate(_getChunk),
                Marshal.GetFunctionPointerForDelegate(_getCurrentBufferSize),
                Marshal.GetFunctionPointerForDelegate(_getNumChunks),
                Marshal.GetFunctionPointerForDelegate(_getSerializationFlags),
                Marshal.GetFunctionPointerForDelegate(_getuniquePointer),
                Marshal.GetFunctionPointerForDelegate(_registernameForPointer),
                Marshal.GetFunctionPointerForDelegate(_serializeName),
                Marshal.GetFunctionPointerForDelegate(_setSerializationFlags),
                Marshal.GetFunctionPointerForDelegate(_startSerialization));
        }
        public Serializer()
        {
            _allocate = new AllocateUnmanagedDelegate(AllocateUnmanaged);
            _finalizeChunk = new FinalizeChunkUnmanagedDelegate(FinalizeChunk);
            _findNameForPointer = new FindNameForPointerUnmanagedDelegate(FindNameForPointer);
            _findPointer = new FindPointerUnmanagedDelegate(FindPointer);
            _finishSerialization = new FinishSerializationUnmanagedDelegate(FinishSerialization);
            _getBufferPointer = new GetBufferPointerUnmanagedDelegate(GetBufferPointer);
            _getChunk = new GetChunkUnmanagedDelegate(GetChunk);
            _getCurrentBufferSize = new GetCurrentBufferSizeUnmanagedDelegate(GetCurrentBufferSize);
            _getNumChunks = new GetNumChunksUnmanagedDelegate(GetNumChunks);
            _getSerializationFlags = new GetSerializationFlagsUnmanagedDelegate(GetSerializationFlags);
            _getuniquePointer = new GetUniquePointerUnmanagedDelegate(GetUniquePointer);
            _registernameForPointer = new RegisterNameForPointerUnmanagedDelegate(RegisterNameForPointer);
            _serializeName = new SerializeNameUnmanagedDelegate(SerializeName);
            _setSerializationFlags = new SetSerializationFlagsUnmanagedDelegate(SetSerializationFlags);
            _startSerialization = new StartSerializationUnmanagedDelegate(StartSerialization);

            _native = btSerializerWrapper_new(
                Marshal.GetFunctionPointerForDelegate(_allocate),
                Marshal.GetFunctionPointerForDelegate(_finalizeChunk),
                Marshal.GetFunctionPointerForDelegate(_findNameForPointer),
                Marshal.GetFunctionPointerForDelegate(_findPointer),
                Marshal.GetFunctionPointerForDelegate(_finishSerialization),
                Marshal.GetFunctionPointerForDelegate(_getBufferPointer),
                Marshal.GetFunctionPointerForDelegate(_getChunk),
                Marshal.GetFunctionPointerForDelegate(_getCurrentBufferSize),
                Marshal.GetFunctionPointerForDelegate(_getNumChunks),
                Marshal.GetFunctionPointerForDelegate(_getSerializationFlags),
                Marshal.GetFunctionPointerForDelegate(_getuniquePointer),
                Marshal.GetFunctionPointerForDelegate(_registernameForPointer),
                Marshal.GetFunctionPointerForDelegate(_serializeName),
                Marshal.GetFunctionPointerForDelegate(_setSerializationFlags),
                Marshal.GetFunctionPointerForDelegate(_startSerialization));
        }