use of delta.games.lotro.maps.data.Labels in project lotro-tools by dmorcellet.
the class CategoriesParser method parse.
/**
* Parse categories definitions from the localization page.
* @param lines Lines to read.
* @return A categories manager.
*/
public CategoriesManager parse(List<String> lines) {
CategoriesManager manager = new CategoriesManager();
if (lines == null) {
return manager;
}
boolean enabled = false;
for (String line : lines) {
if (enabled) {
// 2: { en: "Point of interest", de: "Sehenswertes", fr: "Point d'interet" },
int index = line.indexOf(':');
if (index != -1) {
String categoryCodeStr = line.substring(0, index).trim();
Integer categoryCode = NumericTools.parseInteger(categoryCodeStr);
if (categoryCode != null) {
Category category = new Category(categoryCode.intValue());
Labels labelsManager = category.getLabels();
String labels = line.substring(index + 1).trim();
if (labels.endsWith(","))
labels = labels.substring(0, labels.length() - 1);
ParsingUtils.parseLabels(labelsManager, labels);
manager.addCategory(category);
}
}
}
if (line.contains(TYPES_LINE)) {
enabled = true;
}
}
return manager;
}
use of delta.games.lotro.maps.data.Labels in project lotro-tools by dmorcellet.
the class MapsPageParser method parseMapLine.
private MapBundle parseMapLine(String data) {
MapBundle map = null;
// "angmar", { en: "Angmar", de: "Angmar", fr: "Angmar" }));
try {
int commaIndex = data.indexOf(',');
if (commaIndex != -1) {
String mapKey = data.substring(0, commaIndex);
if (mapKey.startsWith("\""))
mapKey = mapKey.substring(1);
if (mapKey.endsWith("\""))
mapKey = mapKey.substring(0, mapKey.length() - 1);
map = new MapBundle(mapKey);
String labels = data.substring(commaIndex + 1).trim();
if (labels.endsWith("));")) {
labels = labels.substring(0, labels.length() - 3).trim();
}
Labels labelsManager = map.getMap().getLabels();
ParsingUtils.parseLabels(labelsManager, labels);
}
} catch (Exception e) {
_logger.warn("Failed to parse map data [" + data + "]", e);
}
return map;
}
Aggregations