Example #1
0
        //-------------------------------------------------
        //  close - close a file and free all data; also
        //  remove the file if requested
        //-------------------------------------------------
        public void close()
        {
            // close files and free memory
            if (m_zipfile != null)
            {
                m_zipfile.Dispose();
            }
            m_zipfile = null;

            if (m_file != null)
            {
                m_file.Dispose();
            }
            m_file = null;

            m_zipdata.clear();

            if (m_remove_on_close)
            {
                m_osdfile.remove(m_fullpath);
            }

            m_remove_on_close = false;

            // reset our hashes and path as well
            m_hashes.reset();
            m_fullpath = "";
        }
Example #2
0
        public emu_file(string searchpath, u32 openflags)
        {
            m_file                  = null;
            m_iterator              = new path_iterator(searchpath);
            m_mediapaths            = new path_iterator(searchpath);
            m_crc                   = 0;
            m_openflags             = openflags;
            m_zipfile               = null;
            m_ziplength             = 0;
            m_remove_on_close       = false;
            m_restrict_to_mediapath = false;


            // sanity check the open flags
            if ((m_openflags & OPEN_FLAG_HAS_CRC) > 0 && (m_openflags & OPEN_FLAG_WRITE) > 0)
            {
                throw new emu_fatalerror("Attempted to open a file for write with OPEN_FLAG_HAS_CRC");
            }
        }
Example #3
0
        emu_file(u32 openflags, empty_t unused)
        {
            m_filename              = "";
            m_fullpath              = "";
            m_file                  = null;
            m_iterator              = new emu_file_searchpath_vector();
            m_mediapaths            = new emu_file_searchpath_vector();
            m_first                 = true;
            m_crc                   = 0;
            m_openflags             = openflags;
            m_zipfile               = null;
            m_ziplength             = 0;
            m_remove_on_close       = false;
            m_restrict_to_mediapath = 0;


            // sanity check the open flags
            if ((m_openflags & OPEN_FLAG_HAS_CRC) != 0 && (m_openflags & OPEN_FLAG_WRITE) != 0)
            {
                throw new emu_fatalerror("Attempted to open a file for write with OPEN_FLAG_HAS_CRC");
            }
        }
Example #4
0
 /**
  * @fn  chd_error chd_file::open(core_file &file, bool writeable, chd_file *parent)
  *
  * @brief   -------------------------------------------------
  *            open - open an existing file for read or read/write
  *          -------------------------------------------------.
  *
  * @param [in,out]  file    The file.
  * @param   writeable       true if writeable.
  * @param [in,out]  parent  If non-null, the parent.
  *
  * @return  A chd_error.
  */
 public std.error_condition open(util.core_file file, bool writeable = false, chd_file parent = null)
 {
     throw new emu_unimplemented();
 }
Example #5
0
        //-------------------------------------------------
        //  parse_ini_file - parse a series of entries in
        //  an INI file
        //-------------------------------------------------
        public void parse_ini_file(util.core_file inifile, int priority, bool ignore_unknown_options, bool always_override)
        {
            string         error_stream = ""; //std::ostringstream error_stream;
            condition_type condition    = condition_type.NONE;

            // loop over lines in the file
            string buffer;                                 //char buffer[4096];

            while (inifile.gets(out buffer, 4096) != null) //while (inifile.gets(buffer, std::size(buffer)) != nullptr)
            {
                // find the extent of the name
                int optionnameIdx = 0;                                                  //char *optionname;
                for (optionnameIdx = 0; optionnameIdx < buffer.Length; optionnameIdx++) //for (optionname = buffer; *optionname != 0; optionname++)
                {
                    if (isspace(buffer[optionnameIdx]) == 0)                            //if (!isspace((uint8_t)*optionname))
                    {
                        break;
                    }
                }

                // skip comments
                if (optionnameIdx >= buffer.Length || buffer[optionnameIdx] == 0 || buffer[optionnameIdx] == '#')  //if (*optionname == 0 || *optionname == '#')
                {
                    continue;
                }

                // scan forward to find the first space
                int tempIdx;                                                      //char *temp;
                for (tempIdx = optionnameIdx; tempIdx < buffer.Length; tempIdx++) //for (temp = optionname; *temp != 0; temp++)
                {
                    if (isspace(buffer[tempIdx]) != 0)                            //if (isspace((uint8_t)*temp))
                    {
                        break;
                    }
                }

                // if we hit the end early, print a warning and continue
                if (tempIdx >= buffer.Length || buffer[tempIdx] == 0)  //if (*temp == 0)
                {
                    condition = (condition_type)std.max((UInt32)condition, (UInt32)condition_type.WARN);
                    util.stream_format(ref error_stream, "Warning: invalid line in INI: {0}", buffer);
                    continue;
                }

                // NULL-terminate
                tempIdx++;                   //*temp++ = 0;
                int optiondataIdx = tempIdx; //char *optiondata = temp;

                // scan the data, stopping when we hit a comment
                bool inquotes = false;
                for (tempIdx = optiondataIdx; tempIdx < buffer.Length; tempIdx++)  //for (temp = optiondata; *temp != 0; temp++)
                {
                    if (buffer[tempIdx] == '"')
                    {
                        inquotes = !inquotes;
                    }

                    if (buffer[tempIdx] == '#' && !inquotes)
                    {
                        break;
                    }
                }

                //*temp = 0;

                string optionname = buffer.Substring(optionnameIdx, optiondataIdx - optionnameIdx - 1);
                string optiondata = buffer.Substring(optiondataIdx);

                // find our entry
                entry curentry = get_entry(optionname);  //entry::shared_ptr curentry = get_entry(optionname);
                if (curentry == null)
                {
                    if (!ignore_unknown_options)
                    {
                        condition = (condition_type)std.max((UInt32)condition, (UInt32)condition_type.WARN);
                        util.stream_format(ref error_stream, "Warning: unknown option in INI: {0}\n", optionname);
                    }
                    continue;
                }

                // set the new data
                do_set_value(curentry, trim_spaces_and_quotes(optiondata), priority, ref error_stream, condition);
            }

            // did we have any errors that may need to be aggregated?
            throw_options_exception_if_appropriate(condition, error_stream);
        }
Example #6
0
 // parse an XML file into its nodes
 public static file read(util.core_file file, parse_options opts)  //static ptr read(util::core_file &file, parse_options const *opts);
 {
     throw new emu_unimplemented();
 }
Example #7
0
File: png.cs Project: kwanboy/mcs
 public static png_error mng_capture_stop(util.core_file fp)
 {
     throw new emu_unimplemented();
 }
Example #8
0
File: png.cs Project: kwanboy/mcs
        //png_error png_read_bitmap(util::core_file &fp, bitmap_argb32 &bitmap);

        //png_error png_write_bitmap(util::core_file &fp, png_info *info, bitmap_t &bitmap, int palette_length, const rgb_t *palette);

        //png_error mng_capture_start(util::core_file &fp, bitmap_t &bitmap, double rate);
        public static png_error mng_capture_frame(util.core_file fp, png_info info, bitmap_t bitmap, int palette_length, List <rgb_t> palette)
        {
            throw new emu_unimplemented();
        }
Example #9
0
File: chd.cs Project: kwanboy/mcs
 /**
  * @fn  chd_error chd_file::open(core_file &file, bool writeable, chd_file *parent)
  *
  * @brief   -------------------------------------------------
  *            open - open an existing file for read or read/write
  *          -------------------------------------------------.
  *
  * @param [in,out]  file    The file.
  * @param   writeable       true if writeable.
  * @param [in,out]  parent  If non-null, the parent.
  *
  * @return  A chd_error.
  */
 public chd_error open(util.core_file file, bool writeable = false, chd_file parent = null)
 {
     throw new emu_unimplemented();
 }
Example #10
0
 public flac_decoder(util.core_file file)
 {
     throw new emu_unimplemented();
 }
Example #11
0
 //-------------------------------------------------
 //  parse_ini_file - parse a series of entries in
 //  an INI file
 //-------------------------------------------------
 public void parse_ini_file(util.core_file inifile, int priority, bool ignore_unknown_options, bool always_override)
 {
     throw new emu_unimplemented();
 }
Example #12
0
 // INI functionality
 public void parse_ini_file(util.core_file inifile)
 {
     throw new emu_unimplemented();
 }
Example #13
0
 void load_titles(util.core_file file)
 {
     throw new emu_unimplemented();
 }