bool CCharacterScanJob::runForFile(const std::string& fileName) { // load the file into a pdr record static CPersistentDataRecord pdr; pdr.clear(); pdr.readFromFile(fileName.c_str()); // create a character representation and apply the pdr CStatsScanCharacter c; c.apply(pdr); // iterate over the filters executing their core code for (uint32 i=(uint32)_Filters.size();i--;) { if (!_Filters[i]->evaluate(&c)) return true; } // we've been accepted by the filters so add this file to the file list (if there is one) if (_FileList!=NULL) { _FileList->addFile(fileName); } // iterate over the info extractors executing their core code for (uint32 i=0;i<_InfoExtractors.size();++i) { _InfoExtractors[i]->execute(this,&c); } // flush the info collected by the info extractors to the output file CVectorSString words; CSString(fileName).splitFrom("account_").splitTo("_pdr.").splitBySeparator('_',words,false,true,true,true); if (words.size()==2) { charTblFlushRow(words[0].atoi(),words[1].atoi()); } return true; }
void CGuildScanJob::update() { // if nothing left to do then give up if (finished()) return; // treat the next file in the list NLMISC::CSString fileName=_Files[_NextFile].FileName; // read the file contents static CPersistentDataRecord fileContent; fileContent.clear(); fileContent.readFromFile(fileName.c_str()); // add the result to the target guild container if (_GuildContainer!=NULL) { _GuildContainer->addGuildFile(fileName,fileContent); } // move counter on to next file ++_NextFile; }