Search in sources :

Example 1 with ObjectLoader

use of net.runelite.cache.definitions.loaders.ObjectLoader in project runelite by runelite.

the class ObjectManager method load.

public void load() throws IOException {
    ObjectLoader loader = new ObjectLoader();
    Storage storage = store.getStorage();
    Index index = store.getIndex(IndexType.CONFIGS);
    Archive archive = index.getArchive(ConfigType.OBJECT.getId());
    byte[] archiveData = storage.loadArchive(archive);
    ArchiveFiles files = archive.getFiles(archiveData);
    for (FSFile f : files.getFiles()) {
        ObjectDefinition def = loader.load(f.getFileId(), f.getContents());
        objects.put(f.getFileId(), def);
    }
}
Also used : Storage(net.runelite.cache.fs.Storage) Archive(net.runelite.cache.fs.Archive) ArchiveFiles(net.runelite.cache.fs.ArchiveFiles) ObjectLoader(net.runelite.cache.definitions.loaders.ObjectLoader) Index(net.runelite.cache.fs.Index) ObjectDefinition(net.runelite.cache.definitions.ObjectDefinition) FSFile(net.runelite.cache.fs.FSFile)

Example 2 with ObjectLoader

use of net.runelite.cache.definitions.loaders.ObjectLoader in project runelite by runelite.

the class CacheController method getObject.

@RequestMapping("object/{objectId}")
public ObjectDefinition getObject(@PathVariable int objectId) throws IOException {
    ArchiveEntry archiveEntry = findConfig(ConfigType.OBJECT);
    ArchiveFiles archiveFiles = cacheService.getArchiveFiles(archiveEntry);
    if (archiveFiles == null) {
        throw new NotFoundException();
    }
    FSFile file = archiveFiles.findFile(objectId);
    if (file == null) {
        throw new NotFoundException();
    }
    ObjectDefinition objectdef = new ObjectLoader().load(objectId, file.getContents());
    return objectdef;
}
Also used : ArchiveFiles(net.runelite.cache.fs.ArchiveFiles) NotFoundException(net.runelite.http.service.util.exception.NotFoundException) ArchiveEntry(net.runelite.http.service.cache.beans.ArchiveEntry) ObjectDefinition(net.runelite.cache.definitions.ObjectDefinition) ObjectLoader(net.runelite.cache.definitions.loaders.ObjectLoader) FSFile(net.runelite.cache.fs.FSFile) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Aggregations

ObjectDefinition (net.runelite.cache.definitions.ObjectDefinition)2 ObjectLoader (net.runelite.cache.definitions.loaders.ObjectLoader)2 ArchiveFiles (net.runelite.cache.fs.ArchiveFiles)2 FSFile (net.runelite.cache.fs.FSFile)2 Archive (net.runelite.cache.fs.Archive)1 Index (net.runelite.cache.fs.Index)1 Storage (net.runelite.cache.fs.Storage)1 ArchiveEntry (net.runelite.http.service.cache.beans.ArchiveEntry)1 NotFoundException (net.runelite.http.service.util.exception.NotFoundException)1 RequestMapping (org.springframework.web.bind.annotation.RequestMapping)1