コード例 #1
0
ファイル: IOSystem.cs プロジェクト: Kolky/open3mod
        /// <summary>
        /// Constructs a new IOSystem.
        /// </summary>
        public IOSystem() {
            m_openProc = OnAiFileOpenProc;
            m_closeProc = OnAiFileCloseProc;

            AiFileIO fileIO;
            fileIO.OpenProc = Marshal.GetFunctionPointerForDelegate(m_openProc);
            fileIO.CloseProc = Marshal.GetFunctionPointerForDelegate(m_closeProc);
            fileIO.UserData = IntPtr.Zero;

            m_fileIOPtr = MemoryHelper.AllocateMemory(MemoryHelper.SizeOf<AiFileIO>());
            Marshal.StructureToPtr(fileIO, m_fileIOPtr, false);

            m_openedFiles = new Dictionary<IntPtr, IOStream>();
        }
コード例 #2
0
ファイル: IOSystem.cs プロジェクト: zmapleaf/assimp-net
        /// <summary>
        /// Constructs a new IOSystem.
        /// </summary>
        public IOSystem()
        {
            m_openProc  = OnAiFileOpenProc;
            m_closeProc = OnAiFileCloseProc;

            AiFileIO fileIO;

            fileIO.OpenProc  = Marshal.GetFunctionPointerForDelegate(m_openProc);
            fileIO.CloseProc = Marshal.GetFunctionPointerForDelegate(m_closeProc);
            fileIO.UserData  = IntPtr.Zero;

            m_fileIOPtr = MemoryHelper.AllocateMemory(MemoryHelper.SizeOf <AiFileIO>());
            Marshal.StructureToPtr(fileIO, m_fileIOPtr, false);

            m_openedFiles = new Dictionary <IntPtr, IOStream>();
        }
コード例 #3
0
ファイル: IOSystem.cs プロジェクト: zmapleaf/assimp-net
        /// <summary>
        /// Releases unmanaged and - optionally - managed resources.
        /// </summary>
        /// <param name="disposing">True to release both managed and unmanaged resources; False to release only unmanaged resources.</param>
        protected virtual void Dispose(bool disposing)
        {
            if (!m_isDisposed)
            {
                if (m_fileIOPtr != IntPtr.Zero)
                {
                    MemoryHelper.FreeMemory(m_fileIOPtr);
                    m_fileIOPtr = IntPtr.Zero;
                }

                if (disposing)
                {
                    m_openProc  = null;
                    m_closeProc = null;
                    CloseAllFiles();
                }
                m_isDisposed = true;
            }
        }
コード例 #4
0
ファイル: IOSystem.cs プロジェクト: hasanabb/assimp-net
        /// <summary>
        /// Releases unmanaged and - optionally - managed resources.
        /// </summary>
        /// <param name="disposing">True to release both managed and unmanaged resources; False to release only unmanaged resources.</param>
        protected virtual void Dispose(bool disposing)
        {
            if(!m_isDisposed)
            {
                if(m_fileIOPtr != IntPtr.Zero)
                {
                    MemoryHelper.FreeMemory(m_fileIOPtr);
                    m_fileIOPtr = IntPtr.Zero;
                }

                if(disposing)
                {
                    m_openProc = null;
                    m_closeProc = null;
                    CloseAllFiles();
                }
                m_isDisposed = true;
            }
        }