void StatDb::loadXmlFile(const std::string &fileName, const SkipError skipError) { XML::Document doc(fileName, UseVirtFs_true, skipError); XmlNodeConstPtrConst rootNode = doc.rootNode(); if ((rootNode == nullptr) || !xmlNameEqual(rootNode, "stats")) { logger->log("StatDb: Error while loading %s!", fileName.c_str()); if (skipError == SkipError_false) addDefaultStats(); return; } for_each_xml_child_node(node, rootNode) { if (xmlNameEqual(node, "include")) { const std::string name = XML::getProperty(node, "name", ""); if (!name.empty()) loadXmlFile(name, skipError); continue; } else if (xmlNameEqual(node, "basic")) { loadBasicStats(node); } else if (xmlNameEqual(node, "extended")) { // TRANSLATORS: stats page name loadStats(node, _("Extended")); } else if (xmlNameEqual(node, "page")) { std::string page = XML::langProperty(node, "name", ""); if (page.empty()) { reportAlways("Page without name in stats.xml"); page = "Unknown"; } loadStats(node, page); } } if (skipError == SkipError_false) { if (mBasicStats.empty() && mStats.empty()) { reportAlways("StatDb: no stats found"); addDefaultStats(); } } }
//MEDIA METHODS bool Pokemon::loadFromFile() { bool success = true; loadStats(); //cout << pathBody << endl; if (!body.loadFromFile(pathBody)) { cout<<"Failed to load body texture image!"<<endl; success = false; } if (!name.loadFromRenderedText(sName)) { cout<<"Failed to load name texture from text!"<<endl; success = false; } if (!tLv.loadFromRenderedText(sLv)) { cout<<"Failed to load level texture from text!"<<endl; success = false; } width = ground.getWidth(); height = body.getHeight(); return success; }
void Codec::getStats(QStringList *hdrs,QStringList *values,bool is_first) { if(codec_is_framed_changed) { hdrs->push_back("Codec|Framed"); if(isFramed()) { values->push_back("Yes"); } else { values->push_back("No"); } codec_is_framed_changed=false; } if(is_first) { hdrs->push_back("Codec|Channels"); values->push_back(QString().sprintf("%u",codec_channels)); hdrs->push_back("Codec|Samplerate"); values->push_back(QString().sprintf("%u",codec_samplerate)); } if(codec_bytes_processed_changed) { hdrs->push_back("Codec|Bytes Processed"); values->push_back(QString().sprintf("%lu",codec_bytes_processed)); codec_bytes_processed_changed=false; } loadStats(hdrs,values,is_first); }
void loadGame(void) { cJSON *root, *gameJSON; char *text; text = readFile(getSaveFilePath(SAVE_FILENAME)); root = cJSON_Parse(text); gameJSON = cJSON_GetObjectItem(root, "game"); STRNCPY(game.selectedStarSystem, cJSON_GetObjectItem(gameJSON, "selectedStarSystem")->valuestring, MAX_NAME_LENGTH); loadStarSystems(cJSON_GetObjectItem(gameJSON, "starSystems")); loadChallenges(cJSON_GetObjectItem(gameJSON, "challenges")); loadStats(cJSON_GetObjectItem(gameJSON, "stats")); loadTrophies(cJSON_GetObjectItem(gameJSON, "trophies")); loadFighterStats(cJSON_GetObjectItem(gameJSON, "fighterStats")); cJSON_Delete(root); free(text); }
StrategySelector::StrategySelector() { active = true; strategies.push_back(Strategy(Races::Protoss, ProtossMain::getStrategyId())); strategies.push_back(Strategy(Races::Terran, TerranMain::getStrategyId())); strategies.push_back(Strategy(Races::Zerg, LurkerRush::getStrategyId())); strategies.push_back(Strategy(Races::Zerg, ZergMain::getStrategyId())); loadStats(); }
TorrentStatistics::TorrentStatistics(QBtSession* session, QObject* parent) : QObject(parent) , m_session(session) , m_sessionUL(0) , m_sessionDL(0) , m_lastWrite(0) , m_dirty(false) { loadStats(); connect(&m_timer, SIGNAL(timeout()), this, SLOT(gatherStats())); m_timer.start(60 * 1000); }
void ClientWidget::loadEnv() { qList << "get_full_client_list" << "get_client_stats" << "get_client_account_list" << "check_if_owner_has_something" << "delete_owner" << "delete_account"; socket = new QuerySocket( this ); connect( socket, SIGNAL( canGetData() ), this, SLOT( chooseLoadData() ) ); connect( socket, SIGNAL( errorRaised() ), this, SLOT( loadError() ) ); connect( socket, SIGNAL( stateChanged( QAbstractSocket::SocketState ) ), this, SLOT( enableActions() ) ); sSocket = new QuerySocket( this ); connect( sSocket, SIGNAL( canGetData() ), this, SLOT( loadStats() ) ); connect( sSocket, SIGNAL( errorRaised() ), this, SLOT( loadError() ) ); connect( sSocket, SIGNAL( stateChanged( QAbstractSocket::SocketState ) ), this, SLOT( enableActions() ) ); }
void AccountWidget::chooseQuery() { ThreadControl *tc = qobject_cast<ThreadControl *>( sender() ); if( !tc ) return; int i = tc->getIndexOfLastQuery( qList ); if( i < 0 ) return; QString str = tc->getData(); info->showProgressBar( false ); switch(i) { case 0: { loadCurency( str ); break; } case 1: { disconnect( tableWidget, SIGNAL( rowSelected(int) ), this, SLOT( selectRow(int) ) ); loadAccount(str); tableWidget->SetFocus(lastRow); connect( tableWidget, SIGNAL( rowSelected(int) ), this, SLOT( selectRow(int) ) ); break; } case 2: { loadStats( str ); break; } case 3: { checkDeleteAnswer( str ); break; } } }
void loadGame(string sav = savename) { gameExists = false; savefile = fopen(sav.c_str(), "rb"); if(!savefile) { error = true; return; } error = false; load(P); if(P.saveformat < 103) { printf("Savefile format incompatible\n"); return; } loadStats(stats, P.saveformat); if(P.geometry == 0) P.geometry = 8; setDirs(); load(playerpos); load(topx); load(topy); pinfo.charname = loadString(); pinfo.username = loadString(); if(P.twinsNamed) pinfo.twin[0] = loadString(), pinfo.twin[1] = loadString(); if(P.version != VERSION) P.vchanged = true; int set; load(set); for(int i=0; i<MAXARMS; i++) if((set>>i) & 1) wpn[i] = (weapon*) loadS(); if(P.race == R_TROLL || (P.version >= 1030)) { int trollsize; load(trollsize); pinfo.trollwpn.clear(); pinfo.trollkey.resize(trollsize); for(int i=0; i<trollsize; i++) load(pinfo.trollkey[i]); for(int i=0; i<trollsize; i++) pinfo.trollwpn.push_back((weapon*) loadS());; } for(int i=0; i<P.stairqueue; i++) stairqueue.push_back((hydra*) loadS()); pinfo.whistAt.resize(stats.whistSize); for(int i=0; i<stats.whistSize; i++) load(pinfo.whistAt[i]), pinfo.whist.push_back((weapon*) loadS()); for(int y=0; y<SY; y++) for(int x=0; x<SX; x++) { cell& c(M.m[y][x]); c.it = NULL; load(c.type), load(c.mushrooms), load(c.dead), load(c.explored); if(c.mushrooms & ITEMMASK) { c.mushrooms &= ~ITEMMASK; c.it = loadS(); } if(c.type == CT_STAIRUP) stairpos = vec2(x,y); } M.out.clear(); M.out.type = CT_WALL; int32_t i; load(i); hydras.resize(i); for(int i=0; i<size(hydras); i++) { hydra *h = (hydra*) loadS(); hydras[i] = h; M[h->pos].h = h; if(h->color == HC_TWIN) twin = h; } char x; if(error || fread(&x, 1, 1, savefile) != 0) error = true; fclose(savefile); stats.savecount++; if(error) { printf("Error while loading savegame - file deleted\n"); deleteGame(); exit(0); } else gameExists = true; }
bool Database::loadFromPath(const std::wstring& _profilepath, bool collapseOSCalls) { if(_profilepath != profilepath) { profilepath = _profilepath; } clear(); wxFFileInputStream in(profilepath); wxZipInputStream zip(in); wxZipInputStream zipver(in); if (!in.IsOk() || !zip.IsOk() || !zipver.IsOk()) { wxLogError("The profile data cannot be read."); return false; } // Check the version number required. while(true) { wxZipEntry *entry = zipver.GetNextEntry(); if ( !entry ) break; wxString name = entry->GetInternalName(); if (name.Left(8) == "Version " && name.Right(9) == " required") { wxString ver = name.Mid(8, name.Length()-(8+9)); // Add other versions here any time the file format changes. const char *supportedVersions[] = { "0.7", "0.8", "0.81", "0.82", }; bool isSupported = false; for (int n=0; n<sizeof(supportedVersions)/sizeof(char*); n++) { if (ver == supportedVersions[n]) { isSupported = true; break; } } if (!isSupported) { wxLogWarning("Cannot load capture file: %s", name.c_str()); return false; } } } while(true) { wxZipEntry *entry = zip.GetNextEntry(); if ( !entry ) break; wxString name = entry->GetInternalName(); if (name == "Symbols.txt") loadSymbols(zip); else if (name == "Callstacks.txt") loadProcList(zip,collapseOSCalls); else if (name == "IPCounts.txt") loadIpCounts(zip); else if (name == "Stats.txt") loadStats(zip); else if (name.Left(8) == "Version ") {} else { wxLogWarning("Other fluff found in capture file (%s)", name.c_str()); } } setRoot(NULL); return true; }