void lggAutoCorrectFloater::onNotecardLoadComplete(LLVFS *vfs,const LLUUID& asset_uuid,LLAssetType::EType type,void* user_data, S32 status, LLExtStat ext_status) { if(status == LL_ERR_NOERR) { S32 size = vfs->getSize(asset_uuid, type); U8* buffer = new U8[size]; vfs->getData(asset_uuid, type, buffer, 0, size); if(type == LLAssetType::AT_NOTECARD) { LLViewerTextEditor* edit = new LLViewerTextEditor("",LLRect(0,0,0,0),S32_MAX,""); if(edit->importBuffer((char*)buffer, (S32)size)) { llinfos << "decode success" << llendl; std::string card = edit->getText(); edit->die(); LLSD info; std::istringstream ins; // Declare an input string stream. ins.str(card); // Specify string to read. LLSDSerialize::fromXML(info,ins); LGGAutoCorrect::getInstance()->addCorrectionList(info); llinfos << "read success" << llendl; sInstance->updateEnabledStuff(); } else { llinfos << "decode error" << llendl; } } } else { llinfos << "read error" << llendl; } }
void LLFloaterAO::onNotecardLoadComplete(LLVFS *vfs,const LLUUID& asset_uuid,LLAssetType::EType type,void* user_data, S32 status, LLExtStat ext_status) { if(status == LL_ERR_NOERR) { S32 size = vfs->getSize(asset_uuid, type); U8* buffer = new U8[size]; vfs->getData(asset_uuid, type, buffer, 0, size); if(type == LLAssetType::AT_NOTECARD) { LLViewerTextEditor* edit = new LLViewerTextEditor("",LLRect(0,0,0,0),S32_MAX,""); if(edit->importBuffer((char*)buffer, (S32)size)) { llinfos << "ao nc decode success" << llendl; std::string card = edit->getText(); edit->die(); LUA_CALL("OnAONotecardRead") << card << LUA_END; mAOAllAnims.clear(); mAOStands.clear(); //mAODefaultAnims.clear(); struct_stands standsloader; struct_all_anims all_anims_loader; typedef boost::tokenizer<boost::char_separator<char> > tokenizer; boost::char_separator<char> sep("\n"); tokenizer tokline(card, sep); for (tokenizer::iterator line = tokline.begin(); line != tokline.end(); ++line) { std::string strline(*line); boost::regex type("^(\\s*)(\\[ )(.*)( \\])"); boost::smatch what; if (boost::regex_search(strline, what, type)) { boost::char_separator<char> sep("|,"); std::string stranimnames(boost::regex_replace(strline, type, "")); tokenizer tokanimnames(stranimnames, sep); for (tokenizer::iterator anim = tokanimnames.begin(); anim != tokanimnames.end(); ++anim) { std::string strtoken(what[0]); std::string stranim(*anim); int state = GetStateFromToken(strtoken.c_str()); LLUUID animid(getAssetIDByName(stranim)); if (!(animid.notNull())) { cmdline_printchat(llformat("Warning: animation '%s' could not be found (Section: %s).",stranim.c_str(),strtoken.c_str())); } else { all_anims_loader.ao_id = animid; all_anims_loader.anim_name = stranim.c_str(); all_anims_loader.state = state; mAOAllAnims.push_back(all_anims_loader); if (state == STATE_AGENT_STAND) { standsloader.ao_id = animid; standsloader.anim_name = stranim.c_str(); mAOStands.push_back(standsloader); continue; } for (std::vector<struct_default_anims>::iterator iter = mAODefaultAnims.begin(); iter != mAODefaultAnims.end(); ++iter) { if (state == iter->state) iter->ao_id = animid; } } } } } llinfos << "ao nc read sucess" << llendl; loadComboBoxes(); run(); } else { llinfos << "ao nc decode error" << llendl; } } } else { llinfos << "ao nc read error" << llendl; } }