示例#1
0
文件: unzip.cs 项目: kwanboy/mcs
        // open a 7Z file and parse its central directory
        public static error open_7z(string filename, out archive_file result)
        {
            // ensure we start with a nullptr result
            result = null;  //result.reset();

            // see if we are in the cache, and reopen if so
            m7z_file_impl newimpl = m7z_file_impl.find_cached(filename);

            if (newimpl == null)
            {
                // allocate memory for the 7z file structure
                try { newimpl = new m7z_file_impl(filename); }  //try { newimpl = std.make_unique<m7z_file_impl>(filename); }
                catch (Exception e) { return(error.OUT_OF_MEMORY); }
                error err = newimpl.initialize();
                if (err != error.NONE)
                {
                    return(err);
                }
            }

            try
            {
                result = new m7z_file_wrapper(newimpl);  //result = std.make_unique<m7z_file_wrapper>(std::move(newimpl));
                return(error.NONE);
            }
            catch (Exception e)
            {
                m7z_file_impl.close(newimpl);
                return(error.OUT_OF_MEMORY);
            }
        }
示例#2
0
文件: unzip.cs 项目: kwanboy/mcs
        //typedef std::unique_ptr<archive_file> ptr;


        /* ----- archive file access ----- */

        // open a ZIP file and parse its central directory

        /*-------------------------------------------------
        *   zip_file_open - opens a ZIP file for reading
        *  -------------------------------------------------*/
        public static error open_zip(string filename, out archive_file result)
        {
            //throw new emu_unimplemented();

            result = null;
            return(error.UNSUPPORTED);
        }