bool CPlugins::parseCfg(plugin *plugin_data) { std::ifstream inFile; std::string line[20]; int linecount = 0; bool reject = false; inFile.open(plugin_data->cfgfile.c_str()); while (linecount < 20 && getline(inFile, line[linecount++])) {}; plugin_data->type = CPlugins::P_TYPE_DISABLED; plugin_data->integration = CPlugins::I_TYPE_DISABLED; plugin_data->hide = false; for (int i = 0; i < linecount; i++) { std::istringstream iss(line[i]); std::string cmd; std::string parm; getline(iss, cmd, '='); getline(iss, parm, '='); if (cmd == "name") { plugin_data->name = parm; } else if (cmd == "desc") { plugin_data->description = parm; } else if (cmd == "version") { plugin_data->version = parm; } else if (cmd == "type") { plugin_data->type = getPluginType(atoi(parm.c_str())); } else if (cmd == "icon") { plugin_data->icon = parm; } else if (cmd == "hide") { plugin_data->hide = ((parm == "1")?true:false); } else if (cmd == "integration") { plugin_data->integration = getPluginIntegration(atoi(parm)); } } inFile.close(); return !reject; }
// Checks if a filename fits specific filter static bool passesFilter( const wxString& aFileName, int aFilterIndex ) { wxASSERT( aFilterIndex <= FILTER_COUNT ); wxFileName file( aFileName ); boost::optional<IO_MGR::PCB_FILE_T> result = getPluginType( aFileName ); if( !result ) // does not match any supported plugin return false; if( aFilterIndex == 0 ) // any plugin will do return true; return ( fileFilters[aFilterIndex - 1].m_Plugin == *result ); }
bool CPlugins::parseCfg(plugin *plugin_data) { std::ifstream inFile; std::string line[20]; int linecount = 0; bool reject = false; inFile.open(plugin_data->cfgfile.c_str()); while (linecount < 20 && getline(inFile, line[linecount++])) {}; plugin_data->fb = false; plugin_data->rc = false; plugin_data->lcd = false; plugin_data->vtxtpid = false; plugin_data->showpig = false; plugin_data->needoffset = false; plugin_data->hide = false; plugin_data->type = CPlugins::P_TYPE_DISABLED; for (int i = 0; i < linecount; i++) { std::istringstream iss(line[i]); std::string cmd; std::string parm; getline(iss, cmd, '='); getline(iss, parm, '='); if (cmd == "pluginversion") { plugin_data->version = atoi(parm.c_str()); } else if (cmd == "name") { plugin_data->name = parm; } else if (cmd == "desc") { plugin_data->description = parm; } else if (cmd == "depend") { plugin_data->depend = parm; } else if (cmd == "type") { plugin_data->type = getPluginType(atoi(parm.c_str())); } else if (cmd == "needfb") { plugin_data->fb = ((parm == "1")?true:false); } else if (cmd == "needrc") { plugin_data->rc = ((parm == "1")?true:false); } else if (cmd == "needlcd") { plugin_data->lcd = ((parm == "1")?true:false); } else if (cmd == "needvtxtpid") { plugin_data->vtxtpid = ((parm == "1")?true:false); } else if (cmd == "pigon") { plugin_data->showpig = ((parm == "1")?true:false); } else if (cmd == "needoffsets") { plugin_data->needoffset = ((parm == "1")?true:false); } else if (cmd == "hide") { plugin_data->hide = ((parm == "1")?true:false); } else if (cmd == "needenigma") { reject = ((parm == "1")?true:false); } else if (cmd == "icon") { plugin_data->icon = parm; } } inFile.close(); return !reject; }
WIZARD_FPLIB_TABLE::LIBRARY::LIBRARY( const wxString& aPath, const wxString& aDescription ) : m_path( aPath ), m_description( aDescription ), m_status( NOT_CHECKED ) { m_plugin = getPluginType( aPath ); }