示例#1
0
        //-------------------------------------------------
        //  load_zipped_file - load a ZIPped file
        //-------------------------------------------------
        osd_file.error load_zipped_file()
        {
            assert(m_file == null);
            assert(m_zipdata.empty());
            assert(m_zipfile != null);

            // allocate some memory
            m_zipdata.resize((int)m_ziplength);

            // read the data into our buffer and return
            var ziperr = m_zipfile.decompress(m_zipdata, (UInt32)m_zipdata.size());

            if (ziperr != util.archive_file.error.NONE)
            {
                m_zipdata.clear();
                return(osd_file.error.FAILURE);
            }

            // convert to RAM file
            osd_file.error filerr = util.core_file.open_ram(m_zipdata, (UInt32)m_zipdata.size(), m_openflags, out m_file);
            if (filerr != osd_file.error.NONE)
            {
                m_zipdata.clear();
                return(osd_file.error.FAILURE);
            }

            // close out the ZIP file
            m_zipfile.Dispose();
            m_zipfile = null;
            return(osd_file.error.NONE);
        }
示例#2
0
        //-------------------------------------------------
        //  load_zipped_file - load a ZIPped file
        //-------------------------------------------------
        std.error_condition load_zipped_file()
        {
            assert(m_file == null);
            assert(m_zipdata.empty());
            assert(m_zipfile != null);

            // allocate some memory
            m_zipdata.resize(m_ziplength);

            // read the data into our buffer and return
            var ziperr = m_zipfile.decompress(m_zipdata, (uint32_t)m_zipdata.size());

            if (ziperr)
            {
                m_zipdata.clear();
                return(ziperr);
            }

            // convert to RAM file
            std.error_condition filerr = util.core_file.open_ram(m_zipdata, m_zipdata.size(), m_openflags, out m_file);
            if (filerr)
            {
                m_zipdata.clear();
                return(filerr);
            }

            // close out the ZIP file
            m_zipfile.Dispose();
            m_zipfile = null;
            return(new std.error_condition());
        }