Beispiel #1
0
        std.vector <KeyValuePair <string, categoryindex> > m_ini_index;  //std::vector<std::pair<std::string, categoryindex> > m_ini_index;


        // construction/destruction
        //-------------------------------------------------
        //  ctor
        //-------------------------------------------------
        public inifile_manager(ui_options moptions)
        {
            m_options   = moptions;
            m_ini_index = new std.vector <KeyValuePair <string, categoryindex> >();


            // scan directories and create index
            file_enumerator path = new file_enumerator(m_options.categoryini_path());

            for (osd.directory.entry dir = path.next(); dir != null; dir = path.next())
            {
                string name = dir.name;
                if (core_filename_ends_with(name, ".ini"))
                {
                    emu_file file = new emu_file(m_options.categoryini_path(), OPEN_FLAG_READ);
                    if (file.open(name) == osd_file.error.NONE)
                    {
                        init_category(name, file);
                        file.close();
                    }
                }
            }

            //std::stable_sort(m_ini_index.begin(), m_ini_index.end());//, [] (auto const &x, auto const &y) { return 0 > core_stricmp(x.first.c_str(), y.first.c_str()); });
            m_ini_index.Sort((x, y) => { return(core_stricmp(x.Key.c_str(), y.Key.c_str())); });
        }
Beispiel #2
0
        // construction/destruction
        //-------------------------------------------------
        //  ctor
        //-------------------------------------------------
        public favorite_manager(ui_options options)
        {
            m_options   = options;
            m_favorites = new favorites_set();
            m_sorted    = new sorted_favorites();
            m_need_sort = true;


            emu_file file = new emu_file(m_options.ui_path(), OPEN_FLAG_READ);

            if (file.open(FAVORITE_FILENAME) == osd_file.error.NONE)
            {
                string readbuf;
                file.gets(out readbuf, 1024);

                while (readbuf[0] == '[')
                {
                    file.gets(out readbuf, 1024);
                }

                while (file.gets(out readbuf, 1024) != null)
                {
                    ui_software_info tmpmatches = new ui_software_info();
                    tmpmatches.shortname = utils_global.chartrimcarriage(readbuf);
                    file.gets(out readbuf, 1024);
                    tmpmatches.longname = utils_global.chartrimcarriage(readbuf);
                    file.gets(out readbuf, 1024);
                    tmpmatches.parentname = utils_global.chartrimcarriage(readbuf);
                    file.gets(out readbuf, 1024);
                    tmpmatches.year = utils_global.chartrimcarriage(readbuf);
                    file.gets(out readbuf, 1024);
                    tmpmatches.publisher = utils_global.chartrimcarriage(readbuf);
                    file.gets(out readbuf, 1024);
                    tmpmatches.supported = Convert.ToByte(readbuf);
                    file.gets(out readbuf, 1024);
                    tmpmatches.part = utils_global.chartrimcarriage(readbuf);
                    file.gets(out readbuf, 1024);
                    utils_global.chartrimcarriage(readbuf);
                    var dx = driver_list.find(readbuf);
                    if (0 > dx)
                    {
                        continue;
                    }
                    tmpmatches.driver = driver_list.driver(dx);
                    file.gets(out readbuf, 1024);
                    tmpmatches.listname = utils_global.chartrimcarriage(readbuf);
                    file.gets(out readbuf, 1024);
                    tmpmatches.interface_ = utils_global.chartrimcarriage(readbuf);
                    file.gets(out readbuf, 1024);
                    tmpmatches.instance = utils_global.chartrimcarriage(readbuf);
                    file.gets(out readbuf, 1024);
                    tmpmatches.startempty = Convert.ToByte(readbuf);
                    file.gets(out readbuf, 1024);
                    tmpmatches.parentlongname = utils_global.chartrimcarriage(readbuf);
                    file.gets(out readbuf, 1024);
                    tmpmatches.usage = utils_global.chartrimcarriage(readbuf);
                    file.gets(out readbuf, 1024);
                    tmpmatches.devicetype = utils_global.chartrimcarriage(readbuf);
                    file.gets(out readbuf, 1024);
                    tmpmatches.available = Convert.ToInt32(readbuf) != 0;
                    m_favorites.emplace(tmpmatches);
                }
                file.close();
            }
        }
Beispiel #3
0
        // construction/destruction
        //-------------------------------------------------
        //  ctor
        //-------------------------------------------------
        public favorite_manager(ui_options options)
        {
            m_options   = options;
            m_favorites = new favorites_set();
            m_sorted    = new sorted_favorites();
            m_need_sort = true;


            emu_file file = new emu_file(m_options.ui_path(), OPEN_FLAG_READ);

            if (!file.open(FAVORITE_FILENAME))
            {
                string readbuf;  //char readbuf[1024];
                file.gets(out readbuf, 1024);

                while (readbuf[0] == '[')
                {
                    file.gets(out readbuf, 1024);
                }

                while (file.gets(out readbuf, 1024) != null)
                {
                    ui_software_info tmpmatches = new ui_software_info();
                    tmpmatches.shortname = chartrimcarriage(readbuf);
                    file.gets(out readbuf, 1024);
                    tmpmatches.longname = chartrimcarriage(readbuf);
                    file.gets(out readbuf, 1024);
                    tmpmatches.parentname = chartrimcarriage(readbuf);
                    file.gets(out readbuf, 1024);
                    tmpmatches.year = chartrimcarriage(readbuf);
                    file.gets(out readbuf, 1024);
                    tmpmatches.publisher = chartrimcarriage(readbuf);
                    file.gets(out readbuf, 1024);
                    tmpmatches.supported = (software_support)std.atoi(readbuf);
                    file.gets(out readbuf, 1024);
                    tmpmatches.part = chartrimcarriage(readbuf);
                    file.gets(out readbuf, 1024);
                    chartrimcarriage(readbuf);
                    var dx = driver_list.find(readbuf);
                    if (0 > dx)
                    {
                        continue;
                    }
                    tmpmatches.driver = driver_list.driver((size_t)dx);
                    file.gets(out readbuf, 1024);
                    tmpmatches.listname = chartrimcarriage(readbuf);
                    file.gets(out readbuf, 1024);
                    tmpmatches.interface_ = chartrimcarriage(readbuf);
                    file.gets(out readbuf, 1024);
                    tmpmatches.instance = chartrimcarriage(readbuf);
                    file.gets(out readbuf, 1024);
                    tmpmatches.startempty = (uint8_t)std.atoi(readbuf);
                    file.gets(out readbuf, 1024);
                    tmpmatches.parentlongname = chartrimcarriage(readbuf);
                    file.gets(out readbuf, 1024);
                    //tmpmatches.usage = chartrimcarriage(readbuf); TODO: recover multi-line info
                    file.gets(out readbuf, 1024);
                    tmpmatches.devicetype = chartrimcarriage(readbuf);
                    file.gets(out readbuf, 1024);
                    tmpmatches.available = std.atoi(readbuf) != 0;

                    // need to populate this, it isn't displayed anywhere else
                    tmpmatches.infotext = tmpmatches.infotext.append_(tmpmatches.longname);
                    tmpmatches.infotext = tmpmatches.infotext.append_(1, '\n');
                    tmpmatches.infotext = tmpmatches.infotext.append_(__("swlist-info", "Software list/item"));
                    tmpmatches.infotext = tmpmatches.infotext.append_(1, '\n');
                    tmpmatches.infotext = tmpmatches.infotext.append_(tmpmatches.listname);
                    tmpmatches.infotext = tmpmatches.infotext.append_(1, ':');
                    tmpmatches.infotext = tmpmatches.infotext.append_(tmpmatches.shortname);

                    m_favorites.emplace(tmpmatches);
                }

                file.close();
            }
        }