use of delta.games.lotro.character.log.CharacterLogsManager in project lotro-tools by dmorcellet.
the class CharacterLogRepair method doIt.
/**
* Do the job.
* @param toon Targeted toon.
* @return <code>true</code> if it succeeded, <code>false</code> otherwise.
*/
public boolean doIt(CharacterFile toon) {
boolean ok = true;
CharacterLog log = toon.getLastCharacterLog();
List<Long> dates = getDatesToUpdate(log);
if (dates.size() > 0) {
Collections.sort(dates);
Long oldest = dates.get(0);
CharacterLogPageParser parser = new CharacterLogPageParser();
MyLotroConfig cfg = MyLotroConfig.getInstance();
String url = cfg.getCharacterURL(toon.getServerName(), toon.getName());
CharacterLog newLog = parser.parseLogPages(url, oldest);
if (newLog != null) {
for (Long date : dates) {
handleLogItemsReplacementForDate(date, log, newLog);
}
CharacterLogsManager logsManager = toon.getLogsManager();
ok = logsManager.writeNewLog(log);
} else {
ok = false;
}
}
return ok;
}
use of delta.games.lotro.character.log.CharacterLogsManager in project lotro-tools by dmorcellet.
the class MainTestCharacterActivityLogIO method main.
/**
* Basic main method for test.
* @param args Not used.
*/
public static void main(String[] args) {
List<CharacterFile> toons = new ArrayList<CharacterFile>();
LotroTestUtils utils = new LotroTestUtils();
CharacterFile glumlug = utils.getMainToon();
toons.add(glumlug);
MyLotroConfig cfg = MyLotroConfig.getInstance();
CharacterLogPageParser parser = new CharacterLogPageParser();
for (CharacterFile toon : toons) {
String url = cfg.getCharacterURL(toon.getServerName(), toon.getName());
CharacterLog log = parser.parseLogPages(url, null);
if (log != null) {
System.out.println(log);
CharacterLogsManager manager = toon.getLogsManager();
boolean ok = manager.writeNewLog(log);
if (ok) {
System.out.println("OK");
}
}
}
}
Aggregations