use of net.runelite.http.service.cache.beans.ArchiveEntry in project runelite by runelite.
the class CacheController method getCacheArchive.
@RequestMapping("{cacheId}/{indexId}/{archiveId}")
public CacheArchive getCacheArchive(@PathVariable int cacheId, @PathVariable int indexId, @PathVariable int archiveId) {
CacheEntry cache = cacheService.findCache(cacheId);
if (cache == null) {
throw new NotFoundException();
}
IndexEntry indexEntry = cacheService.findIndexForCache(cache, indexId);
if (indexEntry == null) {
throw new NotFoundException();
}
ArchiveEntry archiveEntry = cacheService.findArchiveForIndex(indexEntry, archiveId);
if (archiveEntry == null) {
throw new NotFoundException();
}
return new CacheArchive(archiveEntry.getArchiveId(), archiveEntry.getNameHash(), archiveEntry.getRevision());
}
use of net.runelite.http.service.cache.beans.ArchiveEntry in project runelite by runelite.
the class CacheController method getArchiveData.
@RequestMapping("{cacheId}/{indexId}/{archiveId}/data")
public byte[] getArchiveData(@PathVariable int cacheId, @PathVariable int indexId, @PathVariable int archiveId) {
CacheEntry cache = cacheService.findCache(cacheId);
if (cache == null) {
throw new NotFoundException();
}
IndexEntry indexEntry = cacheService.findIndexForCache(cache, indexId);
if (indexEntry == null) {
throw new NotFoundException();
}
ArchiveEntry archiveEntry = cacheService.findArchiveForIndex(indexEntry, archiveId);
if (archiveEntry == null) {
throw new NotFoundException();
}
return cacheService.getArchive(archiveEntry);
}
use of net.runelite.http.service.cache.beans.ArchiveEntry in project runelite by runelite.
the class CacheController method getNpc.
@RequestMapping("npc/{npcId}")
public NpcDefinition getNpc(@PathVariable int npcId) throws IOException {
ArchiveEntry archiveEntry = findConfig(ConfigType.NPC);
ArchiveFiles archiveFiles = cacheService.getArchiveFiles(archiveEntry);
if (archiveFiles == null) {
throw new NotFoundException();
}
FSFile file = archiveFiles.findFile(npcId);
if (file == null) {
throw new NotFoundException();
}
NpcDefinition npcdef = new NpcLoader().load(npcId, file.getContents());
return npcdef;
}
use of net.runelite.http.service.cache.beans.ArchiveEntry in project runelite by runelite.
the class CacheController method getItem.
@RequestMapping("item/{itemId}")
public ItemDefinition getItem(@PathVariable int itemId) throws IOException {
ArchiveEntry archiveEntry = findConfig(ConfigType.ITEM);
ArchiveFiles archiveFiles = cacheService.getArchiveFiles(archiveEntry);
if (archiveFiles == null) {
throw new NotFoundException();
}
FSFile file = archiveFiles.findFile(itemId);
if (file == null) {
throw new NotFoundException();
}
ItemDefinition itemdef = new ItemLoader().load(itemId, file.getContents());
return itemdef;
}
use of net.runelite.http.service.cache.beans.ArchiveEntry in project runelite by runelite.
the class CacheService method findArchivesForIndex.
public List<ArchiveEntry> findArchivesForIndex(IndexEntry indexEntry) {
try (Connection con = sql2o.open()) {
CacheDAO cacheDao = new CacheDAO();
ResultSetIterable<ArchiveEntry> archiveEntries = cacheDao.findArchivesForIndex(con, indexEntry);
List<ArchiveEntry> archives = new ArrayList<>();
Iterables.addAll(archives, archiveEntries);
return archives;
}
}
Aggregations