Version::Version(const Plugin& plugin) { verString = plugin.Version(); }
void WritePlugin(YAML::Emitter& out, const Plugin& plugin, const Game& game) { out << YAML::BeginMap; out << YAML::Key << "name" << YAML::Value << plugin.Name(); out << YAML::Key << "isActive"; if (game.IsActive(plugin.Name())) out << YAML::Value << true; else out << YAML::Value << false; if (plugin.Crc() != 0) { out << YAML::Key << "crc" << YAML::Value << IntToHexString(plugin.Crc()); } if (!plugin.Version().empty()) { out << YAML::Key << "version" << YAML::Value << boost::locale::translate("Version").str() + ": " + plugin.Version(); } std::set<Tag> tags = plugin.Tags(); std::set<Tag> tagsAdd, tagsRemove; if (!tags.empty()) { for (std::set<Tag>::const_iterator it = tags.begin(), endit = tags.end(); it != endit; ++it) { if (it->IsAddition()) tagsAdd.insert(*it); else tagsRemove.insert(*it); } if (!tagsAdd.empty()) { out << YAML::Key << "tagsAdd" << YAML::Value << tagsAdd; } if (!tagsRemove.empty()) { out << YAML::Key << "tagsRemove" << YAML::Value << tagsRemove; } } std::list<Message> messages = plugin.Messages(); std::set<PluginDirtyInfo> dirtyInfo = plugin.DirtyInfo(); for (std::set<PluginDirtyInfo>::const_iterator it = dirtyInfo.begin(), endit = dirtyInfo.end(); it != endit; ++it) { boost::format f; if (it->ITMs() > 0 && it->UDRs() > 0 && it->DeletedNavmeshes() > 0) f = boost::format(boost::locale::translate("Contains %1% ITM records, %2% UDR records and %3% deleted navmeshes. Clean with %4%.")) % it->ITMs() % it->UDRs() % it->DeletedNavmeshes() % it->CleaningUtility(); else if (it->ITMs() == 0 && it->UDRs() == 0 && it->DeletedNavmeshes() == 0) f = boost::format(boost::locale::translate("Clean with %1%.")) % it->CleaningUtility(); else if (it->ITMs() == 0 && it->UDRs() > 0 && it->DeletedNavmeshes() > 0) f = boost::format(boost::locale::translate("Contains %1% UDR records and %2% deleted navmeshes. Clean with %3%.")) % it->UDRs() % it->DeletedNavmeshes() % it->CleaningUtility(); else if (it->ITMs() == 0 && it->UDRs() == 0 && it->DeletedNavmeshes() > 0) f = boost::format(boost::locale::translate("Contains %1% deleted navmeshes. Clean with %2%.")) % it->DeletedNavmeshes() % it->CleaningUtility(); else if (it->ITMs() == 0 && it->UDRs() > 0 && it->DeletedNavmeshes() == 0) f = boost::format(boost::locale::translate("Contains %1% UDR records. Clean with %2%.")) % it->UDRs() % it->CleaningUtility(); else if (it->ITMs() > 0 && it->UDRs() == 0 && it->DeletedNavmeshes() > 0) f = boost::format(boost::locale::translate("Contains %1% ITM records and %2% deleted navmeshes. Clean with %3%.")) % it->ITMs() % it->DeletedNavmeshes() % it->CleaningUtility(); else if (it->ITMs() > 0 && it->UDRs() == 0 && it->DeletedNavmeshes() == 0) f = boost::format(boost::locale::translate("Contains %1% ITM records. Clean with %2%.")) % it->ITMs() % it->CleaningUtility(); else if (it->ITMs() > 0 && it->UDRs() > 0 && it->DeletedNavmeshes() == 0) f = boost::format(boost::locale::translate("Contains %1% ITM records and %2% UDR records. Clean with %3%.")) % it->ITMs() % it->UDRs() % it->CleaningUtility(); messages.push_back(loot::Message(loot::Message::warn, f.str())); } if (!messages.empty()) { out << YAML::Key << "messages" << YAML::Value << YAML::BeginSeq; for (std::list<Message>::const_iterator it = messages.begin(), endit = messages.end(); it != endit; ++it) { WriteMessage(out, *it); } out << YAML::EndSeq; } out << YAML::EndMap; }