示例#1
0
        internal unsafe MpqFileStream(MpqFileSafeHandle handle, FileAccess accessType, MpqArchive owner)
        {
            _TMPQFileHeader *header = (_TMPQFileHeader *)handle.DangerousGetHandle().ToPointer();

            TFileEntry = *header->pFileEntry;

            FileName    = Marshal.PtrToStringAnsi(TFileEntry.szFileName);
            _handle     = handle;
            _accessType = accessType;
            _owner      = owner;
        }
示例#2
0
        protected override void Dispose(bool disposing)
        {
            base.Dispose(disposing);

            if (disposing)
            {
                if (_handle != null && !_handle.IsInvalid)
                {
                    _handle.Close();
                    _handle = null;
                }

                if (_owner != null)
                {
                    _owner.RemoveOwnedFile(this);
                    _owner = null;
                }
            }
        }