public void load() throws IOException { NpcLoader loader = new NpcLoader(); Storage storage = store.getStorage(); Index index = store.getIndex(IndexType.CONFIGS); Archive archive = index.getArchive(ConfigType.NPC.getId()); byte[] archiveData = storage.loadArchive(archive); ArchiveFiles files = archive.getFiles(archiveData); for (FSFile f : files.getFiles()) { NpcDefinition npc = loader.load(f.getFileId(), f.getContents()); npcs.put(f.getFileId(), npc); } }
public ArchiveFiles getFiles(byte[] data, int[] keys) throws IOException { byte[] decompressedData = decompress(data, keys); ArchiveFiles files = new ArchiveFiles(); for (FileData fileEntry : fileData) { FSFile file = new FSFile(fileEntry.getId()); file.setNameHash(fileEntry.getNameHash()); files.addFile(file); } files.loadContents(decompressedData); return files; }
stream.writeBytes(file.getContents()); byte[] contents = file.getContents(); stream.writeBytes(contents); int chunkSize = file.getSize();
@Test public void testSave() throws Exception { File base = StoreLocation.LOCATION; try (Store store = new Store(base)) { store.load(); Storage storage = store.getStorage(); Index index = store.getIndex(IndexType.INTERFACES); Archive archive = index.getArchive(31); byte[] archiveData = storage.loadArchive(archive); ArchiveFiles files = archive.getFiles(archiveData); FSFile file = files.findFile(76); byte[] contents = file.getContents(); InterfaceDefinition def = new InterfaceLoader().load(0, contents); byte[] b = new InterfaceSaver().save(def); assertArrayEquals(contents, b); } }
this.getFiles().get(0).setContents(data); return; f.setContents(fileContents[i]);
public void load() throws IOException { StructLoader loader = new StructLoader(); Storage storage = store.getStorage(); Index index = store.getIndex(IndexType.CONFIGS); Archive archive = index.getArchive(ConfigType.STRUCT.getId()); byte[] archiveData = storage.loadArchive(archive); ArchiveFiles files = archive.getFiles(archiveData); for (FSFile f : files.getFiles()) { StructDefinition def = loader.load(f.getFileId(), f.getContents()); structs.put(f.getFileId(), def); } }
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); } }
public void load() throws IOException { ItemLoader loader = new ItemLoader(); Storage storage = store.getStorage(); Index index = store.getIndex(IndexType.CONFIGS); Archive archive = index.getArchive(ConfigType.ITEM.getId()); byte[] archiveData = storage.loadArchive(archive); ArchiveFiles files = archive.getFiles(archiveData); for (FSFile f : files.getFiles()) { ItemDefinition def = loader.load(f.getFileId(), f.getContents()); items.put(f.getFileId(), def); } }
public void load() throws IOException { Storage storage = store.getStorage(); Index index = store.getIndex(IndexType.TEXTURES); Archive archive = index.getArchive(0); byte[] archiveData = storage.loadArchive(archive); ArchiveFiles files = archive.getFiles(archiveData); TextureLoader loader = new TextureLoader(); for (FSFile file : files.getFiles()) { TextureDefinition texture = loader.load(file.getFileId(), file.getContents()); textures.add(texture); } }
public void load() throws IOException { Storage storage = store.getStorage(); Index index = store.getIndex(IndexType.CONFIGS); Archive archive = index.getArchive(ConfigType.AREA.getId()); byte[] archiveData = storage.loadArchive(archive); ArchiveFiles files = archive.getFiles(archiveData); for (FSFile file : files.getFiles()) { AreaLoader loader = new AreaLoader(); AreaDefinition area = loader.load(file.getContents(), file.getFileId()); areas.put(area.id, area); } }
public void load() throws IOException { InventoryLoader loader = new InventoryLoader(); Storage storage = store.getStorage(); Index index = store.getIndex(IndexType.CONFIGS); Archive archive = index.getArchive(ConfigType.INV.getId()); byte[] archiveData = storage.loadArchive(archive); ArchiveFiles files = archive.getFiles(archiveData); for (FSFile file : files.getFiles()) { InventoryDefinition inv = loader.load(file.getFileId(), file.getContents()); inventories.add(inv); } }
public void load() throws IOException { Storage storage = store.getStorage(); Index index = store.getIndex(IndexType.CONFIGS); Archive archive = index.getArchive(ConfigType.UNDERLAY.getId()); byte[] archiveData = storage.loadArchive(archive); ArchiveFiles files = archive.getFiles(archiveData); for (FSFile file : files.getFiles()) { UnderlayLoader loader = new UnderlayLoader(); UnderlayDefinition underlay = loader.load(file.getFileId(), file.getContents()); underlays.put(underlay.getId(), underlay); } }
private void loadOverlays(Store store) throws IOException { Storage storage = store.getStorage(); Index index = store.getIndex(IndexType.CONFIGS); Archive archive = index.getArchive(ConfigType.OVERLAY.getId()); byte[] archiveData = storage.loadArchive(archive); ArchiveFiles files = archive.getFiles(archiveData); for (FSFile file : files.getFiles()) { OverlayLoader loader = new OverlayLoader(); OverlayDefinition overlay = loader.load(file.getFileId(), file.getContents()); overlays.put(overlay.getId(), overlay); } }
private void loadUnderlays(Store store) throws IOException { Storage storage = store.getStorage(); Index index = store.getIndex(IndexType.CONFIGS); Archive archive = index.getArchive(ConfigType.UNDERLAY.getId()); byte[] archiveData = storage.loadArchive(archive); ArchiveFiles files = archive.getFiles(archiveData); for (FSFile file : files.getFiles()) { UnderlayLoader loader = new UnderlayLoader(); UnderlayDefinition underlay = loader.load(file.getFileId(), file.getContents()); underlays.put(underlay.getId(), underlay); } }
public void load() throws IOException { Storage storage = store.getStorage(); Index index = store.getIndex(IndexType.CONFIGS); Archive archive = index.getArchive(ConfigType.OVERLAY.getId()); byte[] archiveData = storage.loadArchive(archive); ArchiveFiles files = archive.getFiles(archiveData); for (FSFile file : files.getFiles()) { OverlayLoader loader = new OverlayLoader(); OverlayDefinition overlay = loader.load(file.getFileId(), file.getContents()); overlays.put(overlay.getId(), overlay); } }
public void load() throws IOException { InterfaceLoader loader = new InterfaceLoader(); Storage storage = store.getStorage(); Index index = store.getIndex(IndexType.INTERFACES); int max = index.getArchives().stream().mapToInt(a -> a.getArchiveId()).max().getAsInt(); interfaces = new InterfaceDefinition[max + 1][]; for (Archive archive : index.getArchives()) { int archiveId = archive.getArchiveId(); byte[] archiveData = storage.loadArchive(archive); ArchiveFiles files = archive.getFiles(archiveData); InterfaceDefinition[] ifaces = interfaces[archiveId]; if (ifaces == null) { ifaces = interfaces[archiveId] = new InterfaceDefinition[archive.getFileData().length]; } for (FSFile file : files.getFiles()) { int fileId = file.getFileId(); int widgetId = (archiveId << 16) + fileId; InterfaceDefinition iface = loader.load(widgetId, file.getContents()); ifaces[fileId] = iface; } } }
UnderlayDefinition underlay = loader.load(file.getFileId(), file.getContents()); Files.write(gson.toJson(underlay), new File(outDir, file.getFileId() + ".json"), Charset.defaultCharset()); ++count;
VarbitDefinition varbit = loader.load(file.getFileId(), file.getContents()); Files.write(gson.toJson(varbit), new File(outDir, file.getFileId() + ".json"), Charset.defaultCharset()); ++count;
WorldMapDefinition def = loader.load(file.getContents(), file.getFileId()); Files.write(gson.toJson(def), new File(outDir, file.getFileId() + ".json"), Charset.defaultCharset()); ++count;