Пример #1
0
        /// <summary>
        /// Initializes instance.
        /// </summary>
        /// <param name="bytes">Moc bytes.</param>
        private CubismUnmanagedMoc(byte[] bytes)
        {
            // Allocate and initialize memory (returning on fail).
            var memory = CubismUnmanagedMemory.Allocate(bytes.Length, CubismCoreDll.AlignofMoc);


            if (memory == IntPtr.Zero)
            {
                return;
            }


            CubismUnmanagedMemory.Write(bytes, memory);


            // Revive native moc (cleaning up on fail).
            Ptr = CubismCoreDll.ReviveMocInPlace(memory, (uint)bytes.Length);


            if (Ptr == IntPtr.Zero)
            {
                CubismUnmanagedMemory.Deallocate(memory);
            }
        }