cache: rename File to FSFile
This commit is contained in:
@@ -33,6 +33,7 @@ import net.runelite.cache.definitions.InterfaceDefinition;
|
||||
import net.runelite.cache.definitions.exporters.InterfaceExporter;
|
||||
import net.runelite.cache.definitions.loaders.InterfaceLoader;
|
||||
import net.runelite.cache.fs.Archive;
|
||||
import net.runelite.cache.fs.FSFile;
|
||||
import net.runelite.cache.fs.Index;
|
||||
import net.runelite.cache.fs.Store;
|
||||
import net.runelite.cache.util.Namer;
|
||||
@@ -58,7 +59,7 @@ public class InterfaceManager
|
||||
{
|
||||
int archiveId = archive.getArchiveId();
|
||||
|
||||
for (net.runelite.cache.fs.File file : archive.getFiles())
|
||||
for (FSFile file : archive.getFiles())
|
||||
{
|
||||
int fileId = file.getFileId();
|
||||
|
||||
|
||||
@@ -33,6 +33,7 @@ import net.runelite.cache.definitions.ItemDefinition;
|
||||
import net.runelite.cache.definitions.exporters.ItemExporter;
|
||||
import net.runelite.cache.definitions.loaders.ItemLoader;
|
||||
import net.runelite.cache.fs.Archive;
|
||||
import net.runelite.cache.fs.FSFile;
|
||||
import net.runelite.cache.fs.Index;
|
||||
import net.runelite.cache.fs.Store;
|
||||
import net.runelite.cache.util.Namer;
|
||||
@@ -55,7 +56,7 @@ public class ItemManager
|
||||
Index index = store.getIndex(IndexType.CONFIGS);
|
||||
Archive archive = index.getArchive(ConfigType.ITEM.getId());
|
||||
|
||||
for (net.runelite.cache.fs.File f : archive.getFiles())
|
||||
for (FSFile f : archive.getFiles())
|
||||
{
|
||||
ItemDefinition def = loader.load(f.getFileId(), f.getContents());
|
||||
items.add(def);
|
||||
|
||||
@@ -46,7 +46,7 @@ import net.runelite.cache.definitions.loaders.SpriteLoader;
|
||||
import net.runelite.cache.definitions.loaders.TextureLoader;
|
||||
import net.runelite.cache.definitions.loaders.UnderlayLoader;
|
||||
import net.runelite.cache.fs.Archive;
|
||||
import net.runelite.cache.fs.File;
|
||||
import net.runelite.cache.fs.FSFile;
|
||||
import net.runelite.cache.fs.Index;
|
||||
import net.runelite.cache.fs.Store;
|
||||
import net.runelite.cache.region.Location;
|
||||
@@ -361,7 +361,7 @@ public class MapImageDumper
|
||||
Index index = store.getIndex(IndexType.CONFIGS);
|
||||
Archive archive = index.getArchive(ConfigType.UNDERLAY.getId());
|
||||
|
||||
for (File file : archive.getFiles())
|
||||
for (FSFile file : archive.getFiles())
|
||||
{
|
||||
UnderlayLoader loader = new UnderlayLoader();
|
||||
UnderlayDefinition underlay = loader.load(file.getFileId(), file.getContents());
|
||||
@@ -387,7 +387,7 @@ public class MapImageDumper
|
||||
Index index = store.getIndex(IndexType.CONFIGS);
|
||||
Archive archive = index.getArchive(ConfigType.OVERLAY.getId());
|
||||
|
||||
for (File file : archive.getFiles())
|
||||
for (FSFile file : archive.getFiles())
|
||||
{
|
||||
OverlayLoader loader = new OverlayLoader();
|
||||
OverlayDefinition underlay = loader.load(file.getFileId(), file.getContents());
|
||||
@@ -413,7 +413,7 @@ public class MapImageDumper
|
||||
Index index = store.getIndex(IndexType.TEXTURES);
|
||||
Archive archive = index.getArchive(0);
|
||||
|
||||
for (File file : archive.getFiles())
|
||||
for (FSFile file : archive.getFiles())
|
||||
{
|
||||
TextureLoader loader = new TextureLoader();
|
||||
TextureDefinition texture = loader.load(file.getFileId(), file.getContents());
|
||||
@@ -443,11 +443,11 @@ public class MapImageDumper
|
||||
|
||||
for (Archive a : index.getArchives())
|
||||
{
|
||||
List<File> files = a.getFiles();
|
||||
List<FSFile> files = a.getFiles();
|
||||
|
||||
assert files.size() == 1;
|
||||
|
||||
File file = files.get(0);
|
||||
FSFile file = files.get(0);
|
||||
byte[] contents = file.getContents();
|
||||
|
||||
SpriteLoader loader = new SpriteLoader();
|
||||
@@ -534,7 +534,7 @@ public class MapImageDumper
|
||||
|
||||
ObjectLoader loader = new ObjectLoader();
|
||||
|
||||
for (File f : archive.getFiles())
|
||||
for (FSFile f : archive.getFiles())
|
||||
{
|
||||
ObjectDefinition def = loader.load(f.getFileId(), f.getContents());
|
||||
objects.put(def.getId(), def);
|
||||
|
||||
@@ -33,6 +33,7 @@ import net.runelite.cache.definitions.NpcDefinition;
|
||||
import net.runelite.cache.definitions.exporters.NpcExporter;
|
||||
import net.runelite.cache.definitions.loaders.NpcLoader;
|
||||
import net.runelite.cache.fs.Archive;
|
||||
import net.runelite.cache.fs.FSFile;
|
||||
import net.runelite.cache.fs.Index;
|
||||
import net.runelite.cache.fs.Store;
|
||||
import net.runelite.cache.util.Namer;
|
||||
@@ -55,7 +56,7 @@ public class NpcManager
|
||||
Index index = store.getIndex(IndexType.CONFIGS);
|
||||
Archive archive = index.getArchive(ConfigType.NPC.getId());
|
||||
|
||||
for (net.runelite.cache.fs.File f : archive.getFiles())
|
||||
for (FSFile f : archive.getFiles())
|
||||
{
|
||||
NpcDefinition npc = loader.load(f.getFileId(), f.getContents());
|
||||
npcs.add(npc);
|
||||
|
||||
@@ -33,6 +33,7 @@ import net.runelite.cache.definitions.ObjectDefinition;
|
||||
import net.runelite.cache.definitions.exporters.ObjectExporter;
|
||||
import net.runelite.cache.definitions.loaders.ObjectLoader;
|
||||
import net.runelite.cache.fs.Archive;
|
||||
import net.runelite.cache.fs.FSFile;
|
||||
import net.runelite.cache.fs.Index;
|
||||
import net.runelite.cache.fs.Store;
|
||||
import net.runelite.cache.util.Namer;
|
||||
@@ -55,7 +56,7 @@ public class ObjectManager
|
||||
Index index = store.getIndex(IndexType.CONFIGS);
|
||||
Archive archive = index.getArchive(ConfigType.OBJECT.getId());
|
||||
|
||||
for (net.runelite.cache.fs.File f : archive.getFiles())
|
||||
for (FSFile f : archive.getFiles())
|
||||
{
|
||||
ObjectDefinition def = loader.load(f.getFileId(), f.getContents());
|
||||
objects.add(def);
|
||||
|
||||
@@ -33,6 +33,7 @@ import net.runelite.cache.definitions.SpriteDefinition;
|
||||
import net.runelite.cache.definitions.exporters.SpriteExporter;
|
||||
import net.runelite.cache.definitions.loaders.SpriteLoader;
|
||||
import net.runelite.cache.fs.Archive;
|
||||
import net.runelite.cache.fs.FSFile;
|
||||
import net.runelite.cache.fs.Index;
|
||||
import net.runelite.cache.fs.Store;
|
||||
|
||||
@@ -52,11 +53,11 @@ public class SpriteManager
|
||||
|
||||
for (Archive a : index.getArchives())
|
||||
{
|
||||
List<net.runelite.cache.fs.File> files = a.getFiles();
|
||||
List<FSFile> files = a.getFiles();
|
||||
|
||||
assert files.size() == 1;
|
||||
|
||||
net.runelite.cache.fs.File file = files.get(0);
|
||||
FSFile file = files.get(0);
|
||||
byte[] contents = file.getContents();
|
||||
|
||||
SpriteLoader loader = new SpriteLoader();
|
||||
|
||||
@@ -29,7 +29,7 @@ import java.util.List;
|
||||
import net.runelite.cache.definitions.TextureDefinition;
|
||||
import net.runelite.cache.definitions.loaders.TextureLoader;
|
||||
import net.runelite.cache.fs.Archive;
|
||||
import net.runelite.cache.fs.File;
|
||||
import net.runelite.cache.fs.FSFile;
|
||||
import net.runelite.cache.fs.Index;
|
||||
import net.runelite.cache.fs.Store;
|
||||
|
||||
@@ -50,7 +50,7 @@ public class TextureManager
|
||||
|
||||
TextureLoader loader = new TextureLoader();
|
||||
|
||||
for (File file : archive.getFiles())
|
||||
for (FSFile file : archive.getFiles())
|
||||
{
|
||||
TextureDefinition texture = loader.load(file.getFileId(), file.getContents());
|
||||
textures.add(texture);
|
||||
|
||||
@@ -25,6 +25,7 @@
|
||||
package net.runelite.cache.fs;
|
||||
|
||||
import com.google.common.io.Files;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.nio.charset.Charset;
|
||||
import java.util.ArrayList;
|
||||
@@ -52,7 +53,7 @@ public class Archive
|
||||
private int revision;
|
||||
private int compression;
|
||||
|
||||
private List<File> files = new ArrayList<>();
|
||||
private List<FSFile> files = new ArrayList<>();
|
||||
|
||||
public Archive(Index index, int id)
|
||||
{
|
||||
@@ -112,9 +113,9 @@ public class Archive
|
||||
this.data = data;
|
||||
}
|
||||
|
||||
public File addFile(int id)
|
||||
public FSFile addFile(int id)
|
||||
{
|
||||
File file = new File(this, id);
|
||||
FSFile file = new FSFile(this, id);
|
||||
this.files.add(file);
|
||||
return file;
|
||||
}
|
||||
@@ -127,7 +128,7 @@ public class Archive
|
||||
{
|
||||
int fileId = archive += protocol >= 7 ? stream.readBigSmart() : stream.readUnsignedShort();
|
||||
|
||||
File file = new File(this, fileId);
|
||||
FSFile file = new FSFile(this, fileId);
|
||||
this.files.add(file);
|
||||
}
|
||||
}
|
||||
@@ -228,7 +229,7 @@ public class Archive
|
||||
|
||||
for (int i = 0; i < filesCount; ++i)
|
||||
{
|
||||
File f = this.getFiles().get(i);
|
||||
FSFile f = this.getFiles().get(i);
|
||||
f.setContents(fileContents[i]);
|
||||
}
|
||||
}
|
||||
@@ -241,12 +242,12 @@ public class Archive
|
||||
|
||||
if (filesCount == 1)
|
||||
{
|
||||
File file = this.getFiles().get(0);
|
||||
FSFile file = this.getFiles().get(0);
|
||||
stream.writeBytes(file.getContents());
|
||||
}
|
||||
else
|
||||
{
|
||||
for (File file : this.getFiles())
|
||||
for (FSFile file : this.getFiles())
|
||||
{
|
||||
byte[] contents = file.getContents();
|
||||
stream.writeBytes(contents);
|
||||
@@ -254,7 +255,7 @@ public class Archive
|
||||
|
||||
int offset = 0;
|
||||
|
||||
for (File file : this.getFiles())
|
||||
for (FSFile file : this.getFiles())
|
||||
{
|
||||
int chunkSize = file.getSize();
|
||||
|
||||
@@ -273,63 +274,63 @@ public class Archive
|
||||
return fileData;
|
||||
}
|
||||
|
||||
public void saveTree(java.io.File to) throws IOException
|
||||
public void saveTree(File to) throws IOException
|
||||
{
|
||||
if (data != null)
|
||||
{
|
||||
assert files.size() == 1; // this is the maps
|
||||
|
||||
File file = files.get(0);
|
||||
FSFile file = files.get(0);
|
||||
|
||||
java.io.File archiveFile = new java.io.File(to, this.getArchiveId() + "-"
|
||||
File archiveFile = new File(to, this.getArchiveId() + "-"
|
||||
+ file.getFileId() + "-" + Integer.toHexString(file.getNameHash()) + ".datc");
|
||||
Files.write(data, archiveFile);
|
||||
|
||||
archiveFile = new java.io.File(to, this.getArchiveId() + ".rev");
|
||||
archiveFile = new File(to, this.getArchiveId() + ".rev");
|
||||
Files.write("" + this.getRevision(), archiveFile, Charset.defaultCharset());
|
||||
|
||||
archiveFile = new java.io.File(to, this.getArchiveId() + ".name");
|
||||
archiveFile = new File(to, this.getArchiveId() + ".name");
|
||||
Files.write("" + this.getNameHash(), archiveFile, Charset.defaultCharset());
|
||||
return;
|
||||
}
|
||||
|
||||
if (files.size() == 1)
|
||||
{
|
||||
File file = this.getFiles().get(0);
|
||||
FSFile file = this.getFiles().get(0);
|
||||
|
||||
java.io.File archiveFile = new java.io.File(to, this.getArchiveId() + "-"
|
||||
File archiveFile = new File(to, this.getArchiveId() + "-"
|
||||
+ file.getFileId() + "-" + Integer.toHexString(file.getNameHash()) + ".dat");
|
||||
byte[] contents = file.getContents();
|
||||
|
||||
Files.write(contents, archiveFile);
|
||||
|
||||
archiveFile = new java.io.File(to, this.getArchiveId() + ".rev");
|
||||
archiveFile = new File(to, this.getArchiveId() + ".rev");
|
||||
Files.write("" + this.getRevision(), archiveFile, Charset.defaultCharset());
|
||||
|
||||
archiveFile = new java.io.File(to, this.getArchiveId() + ".name");
|
||||
archiveFile = new File(to, this.getArchiveId() + ".name");
|
||||
Files.write("" + this.getNameHash(), archiveFile, Charset.defaultCharset());
|
||||
return;
|
||||
}
|
||||
|
||||
java.io.File archiveFile = new java.io.File(to, this.getArchiveId() + ".rev");
|
||||
File archiveFile = new File(to, this.getArchiveId() + ".rev");
|
||||
Files.write("" + this.getRevision(), archiveFile, Charset.defaultCharset());
|
||||
|
||||
archiveFile = new java.io.File(to, this.getArchiveId() + ".name");
|
||||
archiveFile = new File(to, this.getArchiveId() + ".name");
|
||||
Files.write("" + this.getNameHash(), archiveFile, Charset.defaultCharset());
|
||||
|
||||
java.io.File archiveFolder = new java.io.File(to, "" + this.getArchiveId());
|
||||
File archiveFolder = new File(to, "" + this.getArchiveId());
|
||||
archiveFolder.mkdirs();
|
||||
|
||||
for (File file : files)
|
||||
for (FSFile file : files)
|
||||
{
|
||||
archiveFile = new java.io.File(archiveFolder, file.getFileId() + "-"
|
||||
archiveFile = new File(archiveFolder, file.getFileId() + "-"
|
||||
+ Integer.toHexString(file.getNameHash()) + ".dat");
|
||||
byte[] contents = file.getContents();
|
||||
Files.write(contents, archiveFile);
|
||||
}
|
||||
}
|
||||
|
||||
public void loadTreeData(java.io.File parent, java.io.File from) throws IOException
|
||||
public void loadTreeData(File parent, File from) throws IOException
|
||||
{
|
||||
//archiveId-fileId-fileName
|
||||
String[] parts = Files.getNameWithoutExtension(from.getName()).split("-");
|
||||
@@ -343,21 +344,21 @@ public class Archive
|
||||
|
||||
data = Files.toByteArray(from);
|
||||
|
||||
File file = new File(this, fileId);
|
||||
FSFile file = new FSFile(this, fileId);
|
||||
file.setNameHash(nameHash);
|
||||
|
||||
files.add(file);
|
||||
|
||||
java.io.File archiveFile = new java.io.File(parent, this.getArchiveId() + ".rev");
|
||||
File archiveFile = new File(parent, this.getArchiveId() + ".rev");
|
||||
int rev = Integer.parseInt(Files.readFirstLine(archiveFile, Charset.defaultCharset()));
|
||||
this.setRevision(rev);
|
||||
|
||||
archiveFile = new java.io.File(parent, this.getArchiveId() + ".name");
|
||||
archiveFile = new File(parent, this.getArchiveId() + ".name");
|
||||
int name = Integer.parseInt(Files.readFirstLine(archiveFile, Charset.defaultCharset()));
|
||||
this.setNameHash(name);
|
||||
}
|
||||
|
||||
public void loadTreeSingleFile(java.io.File parent, java.io.File from) throws IOException
|
||||
public void loadTreeSingleFile(File parent, File from) throws IOException
|
||||
{
|
||||
//archiveId-fileId-fileName
|
||||
String[] parts = Files.getNameWithoutExtension(from.getName()).split("-");
|
||||
@@ -369,7 +370,7 @@ public class Archive
|
||||
|
||||
assert archiveId == this.getArchiveId();
|
||||
|
||||
File file = new File(this, fileId);
|
||||
FSFile file = new FSFile(this, fileId);
|
||||
file.setNameHash(nameHash);
|
||||
|
||||
byte[] contents = Files.toByteArray(from);
|
||||
@@ -377,18 +378,18 @@ public class Archive
|
||||
|
||||
files.add(file);
|
||||
|
||||
java.io.File archiveFile = new java.io.File(parent, this.getArchiveId() + ".rev");
|
||||
File archiveFile = new File(parent, this.getArchiveId() + ".rev");
|
||||
int rev = Integer.parseInt(Files.readFirstLine(archiveFile, Charset.defaultCharset()));
|
||||
this.setRevision(rev);
|
||||
|
||||
archiveFile = new java.io.File(parent, this.getArchiveId() + ".name");
|
||||
archiveFile = new File(parent, this.getArchiveId() + ".name");
|
||||
int name = Integer.parseInt(Files.readFirstLine(archiveFile, Charset.defaultCharset()));
|
||||
this.setNameHash(name);
|
||||
}
|
||||
|
||||
public void loadTree(java.io.File parent, java.io.File from) throws IOException
|
||||
public void loadTree(File parent, File from) throws IOException
|
||||
{
|
||||
for (java.io.File file : from.listFiles())
|
||||
for (File file : from.listFiles())
|
||||
{
|
||||
//fileId-fileName.dat
|
||||
String[] split = Files.getNameWithoutExtension(file.getName()).split("-");
|
||||
@@ -397,7 +398,7 @@ public class Archive
|
||||
int fileId = Integer.parseInt(split[0]);
|
||||
int fileName = (int) Long.parseLong(split[1], 16);
|
||||
|
||||
File f = new File(this, fileId);
|
||||
FSFile f = new FSFile(this, fileId);
|
||||
f.setNameHash(fileName);
|
||||
|
||||
byte[] contents = Files.toByteArray(file);
|
||||
@@ -406,11 +407,11 @@ public class Archive
|
||||
files.add(f);
|
||||
}
|
||||
|
||||
java.io.File archiveFile = new java.io.File(parent, this.getArchiveId() + ".rev");
|
||||
File archiveFile = new File(parent, this.getArchiveId() + ".rev");
|
||||
int rev = Integer.parseInt(Files.readFirstLine(archiveFile, Charset.defaultCharset()));
|
||||
this.setRevision(rev);
|
||||
|
||||
archiveFile = new java.io.File(parent, this.getArchiveId() + ".name");
|
||||
archiveFile = new File(parent, this.getArchiveId() + ".name");
|
||||
int name = Integer.parseInt(Files.readFirstLine(archiveFile, Charset.defaultCharset()));
|
||||
this.setNameHash(name);
|
||||
|
||||
@@ -422,7 +423,7 @@ public class Archive
|
||||
{
|
||||
for (int i = 0; i < numberOfFiles; ++i)
|
||||
{
|
||||
File file = this.files.get(i);
|
||||
FSFile file = this.files.get(i);
|
||||
int name = stream.readInt();
|
||||
file.setNameHash(name);
|
||||
}
|
||||
@@ -483,7 +484,7 @@ public class Archive
|
||||
this.compression = compression;
|
||||
}
|
||||
|
||||
public List<File> getFiles()
|
||||
public List<FSFile> getFiles()
|
||||
{
|
||||
return files;
|
||||
}
|
||||
|
||||
@@ -27,14 +27,14 @@ package net.runelite.cache.fs;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
||||
public class File
|
||||
public class FSFile
|
||||
{
|
||||
private Archive archive;
|
||||
private int fileId;
|
||||
private int nameHash;
|
||||
private byte[] contents;
|
||||
|
||||
public File(Archive archive, int fileId)
|
||||
public FSFile(Archive archive, int fileId)
|
||||
{
|
||||
this.archive = archive;
|
||||
this.fileId = fileId;
|
||||
@@ -61,7 +61,7 @@ public class File
|
||||
{
|
||||
return false;
|
||||
}
|
||||
final File other = (File) obj;
|
||||
final FSFile other = (FSFile) obj;
|
||||
if (this.fileId != other.fileId)
|
||||
{
|
||||
return false;
|
||||
@@ -28,6 +28,7 @@ import com.google.common.io.Files;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import io.netty.buffer.Unpooled;
|
||||
import java.io.Closeable;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.nio.charset.Charset;
|
||||
import java.util.ArrayList;
|
||||
@@ -288,9 +289,9 @@ public class Index implements Closeable
|
||||
this.whirlpool = res.whirlpool;
|
||||
}
|
||||
|
||||
public void saveTree(java.io.File to) throws IOException
|
||||
public void saveTree(File to) throws IOException
|
||||
{
|
||||
java.io.File idx = new java.io.File(to, "" + this.getId());
|
||||
File idx = new File(to, "" + this.getId());
|
||||
idx.mkdirs();
|
||||
|
||||
for (Archive a : archives)
|
||||
@@ -298,13 +299,13 @@ public class Index implements Closeable
|
||||
a.saveTree(idx);
|
||||
}
|
||||
|
||||
java.io.File rev = new java.io.File(to, this.getId() + ".rev");
|
||||
File rev = new File(to, this.getId() + ".rev");
|
||||
Files.write("" + this.getRevision(), rev, Charset.defaultCharset());
|
||||
}
|
||||
|
||||
public void loadTree(java.io.File parent, java.io.File to) throws IOException
|
||||
public void loadTree(File parent, File to) throws IOException
|
||||
{
|
||||
for (java.io.File f : to.listFiles())
|
||||
for (File f : to.listFiles())
|
||||
{
|
||||
if (f.isDirectory())
|
||||
{
|
||||
@@ -338,7 +339,7 @@ public class Index implements Closeable
|
||||
}
|
||||
}
|
||||
|
||||
String str = Files.readFirstLine(new java.io.File(parent, this.getId() + ".rev"), Charset.defaultCharset());
|
||||
String str = Files.readFirstLine(new File(parent, this.getId() + ".rev"), Charset.defaultCharset());
|
||||
revision = Integer.parseInt(str);
|
||||
|
||||
Collections.sort(archives, (ar1, ar2) -> Integer.compare(ar1.getArchiveId(), ar2.getArchiveId()));
|
||||
@@ -591,12 +592,12 @@ public class Index implements Closeable
|
||||
|
||||
for (index2 = 0; index2 < a.getFiles().size(); ++index2)
|
||||
{
|
||||
File file = a.getFiles().get(index2);
|
||||
FSFile file = a.getFiles().get(index2);
|
||||
int offset = file.getFileId();
|
||||
|
||||
if (index2 != 0)
|
||||
{
|
||||
File prev = a.getFiles().get(index2 - 1);
|
||||
FSFile prev = a.getFiles().get(index2 - 1);
|
||||
offset -= prev.getFileId();
|
||||
}
|
||||
|
||||
@@ -619,7 +620,7 @@ public class Index implements Closeable
|
||||
|
||||
for (index2 = 0; index2 < a.getFiles().size(); ++index2)
|
||||
{
|
||||
File file = a.getFiles().get(index2);
|
||||
FSFile file = a.getFiles().get(index2);
|
||||
stream.writeInt(file.getNameHash());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -167,7 +167,7 @@ public class Store implements Closeable
|
||||
}
|
||||
}
|
||||
|
||||
public void saveTree(java.io.File to) throws IOException
|
||||
public void saveTree(File to) throws IOException
|
||||
{
|
||||
for (Index i : indexes)
|
||||
{
|
||||
@@ -175,9 +175,9 @@ public class Store implements Closeable
|
||||
}
|
||||
}
|
||||
|
||||
public void loadTree(java.io.File from) throws IOException
|
||||
public void loadTree(File from) throws IOException
|
||||
{
|
||||
for (java.io.File idx : from.listFiles())
|
||||
for (File idx : from.listFiles())
|
||||
{
|
||||
if (!idx.isDirectory())
|
||||
{
|
||||
|
||||
@@ -27,12 +27,13 @@ package net.runelite.cache;
|
||||
import com.google.common.io.Files;
|
||||
import com.google.gson.Gson;
|
||||
import com.google.gson.GsonBuilder;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.nio.charset.Charset;
|
||||
import net.runelite.cache.definitions.AreaDefinition;
|
||||
import net.runelite.cache.definitions.loaders.AreaLoader;
|
||||
import net.runelite.cache.fs.Archive;
|
||||
import net.runelite.cache.fs.File;
|
||||
import net.runelite.cache.fs.FSFile;
|
||||
import net.runelite.cache.fs.Index;
|
||||
import net.runelite.cache.fs.Store;
|
||||
import org.junit.Rule;
|
||||
@@ -53,7 +54,7 @@ public class AreaDumper
|
||||
@Test
|
||||
public void extract() throws IOException
|
||||
{
|
||||
java.io.File base = StoreLocation.LOCATION,
|
||||
File base = StoreLocation.LOCATION,
|
||||
outDir = folder.newFolder();
|
||||
|
||||
int count = 0;
|
||||
@@ -65,12 +66,12 @@ public class AreaDumper
|
||||
Index index = store.getIndex(IndexType.CONFIGS);
|
||||
Archive archive = index.getArchive(ConfigType.AREA.getId());
|
||||
|
||||
for (File file : archive.getFiles())
|
||||
for (FSFile file : archive.getFiles())
|
||||
{
|
||||
AreaLoader loader = new AreaLoader();
|
||||
AreaDefinition area = loader.load(file.getContents(), file.getFileId());
|
||||
|
||||
Files.write(gson.toJson(area), new java.io.File(outDir, file.getFileId() + ".json"), Charset.defaultCharset());
|
||||
Files.write(gson.toJson(area), new File(outDir, file.getFileId() + ".json"), Charset.defaultCharset());
|
||||
++count;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -34,6 +34,7 @@ import java.nio.charset.Charset;
|
||||
import net.runelite.cache.definitions.EnumDefinition;
|
||||
import net.runelite.cache.definitions.loaders.EnumLoader;
|
||||
import net.runelite.cache.fs.Archive;
|
||||
import net.runelite.cache.fs.FSFile;
|
||||
import net.runelite.cache.fs.Index;
|
||||
import net.runelite.cache.fs.Store;
|
||||
import org.junit.Rule;
|
||||
@@ -66,7 +67,7 @@ public class EnumDumperTest
|
||||
|
||||
EnumLoader loader = new EnumLoader();
|
||||
|
||||
for (net.runelite.cache.fs.File file : archive.getFiles())
|
||||
for (FSFile file : archive.getFiles())
|
||||
{
|
||||
byte[] b = file.getContents();
|
||||
|
||||
|
||||
@@ -27,6 +27,7 @@ package net.runelite.cache;
|
||||
import com.google.common.io.Files;
|
||||
import com.google.gson.Gson;
|
||||
import com.google.gson.GsonBuilder;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.nio.charset.Charset;
|
||||
import java.util.ArrayList;
|
||||
@@ -36,7 +37,7 @@ import net.runelite.cache.definitions.FramemapDefinition;
|
||||
import net.runelite.cache.definitions.loaders.FrameLoader;
|
||||
import net.runelite.cache.definitions.loaders.FramemapLoader;
|
||||
import net.runelite.cache.fs.Archive;
|
||||
import net.runelite.cache.fs.File;
|
||||
import net.runelite.cache.fs.FSFile;
|
||||
import net.runelite.cache.fs.Index;
|
||||
import net.runelite.cache.fs.Store;
|
||||
import org.junit.Rule;
|
||||
@@ -57,7 +58,7 @@ public class FrameDumper
|
||||
//@Test
|
||||
public void extract() throws IOException
|
||||
{
|
||||
java.io.File base = StoreLocation.LOCATION,
|
||||
File base = StoreLocation.LOCATION,
|
||||
outDir = folder.newFolder();
|
||||
|
||||
int count = 0;
|
||||
@@ -73,7 +74,7 @@ public class FrameDumper
|
||||
{
|
||||
List<FrameDefinition> frames = new ArrayList<>();
|
||||
|
||||
for (File file : archive.getFiles())
|
||||
for (FSFile file : archive.getFiles())
|
||||
{
|
||||
byte[] contents = file.getContents();
|
||||
|
||||
@@ -81,7 +82,7 @@ public class FrameDumper
|
||||
|
||||
Archive framemapArchive = framemapIndex.getArchives().get(framemapArchiveId);
|
||||
assert framemapArchive.getFiles().size() == 1;
|
||||
File framemapFile = framemapArchive.getFiles().get(0);
|
||||
FSFile framemapFile = framemapArchive.getFiles().get(0);
|
||||
|
||||
FramemapLoader fmloader = new FramemapLoader();
|
||||
FramemapDefinition framemap = fmloader.load(framemapFile.getFileId(), framemapFile.getContents());
|
||||
@@ -92,7 +93,7 @@ public class FrameDumper
|
||||
frames.add(frame);
|
||||
}
|
||||
|
||||
Files.write(gson.toJson(frames), new java.io.File(outDir, archive.getArchiveId() + ".json"), Charset.defaultCharset());
|
||||
Files.write(gson.toJson(frames), new File(outDir, archive.getArchiveId() + ".json"), Charset.defaultCharset());
|
||||
++count;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -27,12 +27,13 @@ package net.runelite.cache;
|
||||
import com.google.common.io.Files;
|
||||
import com.google.gson.Gson;
|
||||
import com.google.gson.GsonBuilder;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.nio.charset.Charset;
|
||||
import net.runelite.cache.definitions.FramemapDefinition;
|
||||
import net.runelite.cache.definitions.loaders.FramemapLoader;
|
||||
import net.runelite.cache.fs.Archive;
|
||||
import net.runelite.cache.fs.File;
|
||||
import net.runelite.cache.fs.FSFile;
|
||||
import net.runelite.cache.fs.Index;
|
||||
import net.runelite.cache.fs.Store;
|
||||
import org.junit.Rule;
|
||||
@@ -53,7 +54,7 @@ public class FramemapDumper
|
||||
@Test
|
||||
public void extract() throws IOException
|
||||
{
|
||||
java.io.File base = StoreLocation.LOCATION,
|
||||
File base = StoreLocation.LOCATION,
|
||||
outDir = folder.newFolder();
|
||||
|
||||
int count = 0;
|
||||
@@ -66,12 +67,12 @@ public class FramemapDumper
|
||||
for (Archive archive : index.getArchives())
|
||||
{
|
||||
assert archive.getFiles().size() == 1;
|
||||
File file = archive.getFiles().get(0);
|
||||
FSFile file = archive.getFiles().get(0);
|
||||
|
||||
FramemapLoader loader = new FramemapLoader();
|
||||
FramemapDefinition framemap = loader.load(file.getFileId(), file.getContents());
|
||||
|
||||
Files.write(gson.toJson(framemap), new java.io.File(outDir, archive.getArchiveId() + ".json"), Charset.defaultCharset());
|
||||
Files.write(gson.toJson(framemap), new File(outDir, archive.getArchiveId() + ".json"), Charset.defaultCharset());
|
||||
++count;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -27,12 +27,13 @@ package net.runelite.cache;
|
||||
import com.google.common.io.Files;
|
||||
import com.google.gson.Gson;
|
||||
import com.google.gson.GsonBuilder;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.nio.charset.Charset;
|
||||
import net.runelite.cache.definitions.InventoryDefinition;
|
||||
import net.runelite.cache.definitions.loaders.InventoryLoader;
|
||||
import net.runelite.cache.fs.Archive;
|
||||
import net.runelite.cache.fs.File;
|
||||
import net.runelite.cache.fs.FSFile;
|
||||
import net.runelite.cache.fs.Index;
|
||||
import net.runelite.cache.fs.Store;
|
||||
import org.junit.Rule;
|
||||
@@ -53,7 +54,7 @@ public class InventoryDumper
|
||||
@Test
|
||||
public void extract() throws IOException
|
||||
{
|
||||
java.io.File base = StoreLocation.LOCATION,
|
||||
File base = StoreLocation.LOCATION,
|
||||
outDir = folder.newFolder();
|
||||
|
||||
int count = 0;
|
||||
@@ -65,12 +66,12 @@ public class InventoryDumper
|
||||
Index index = store.getIndex(IndexType.CONFIGS);
|
||||
Archive archive = index.getArchive(ConfigType.INV.getId());
|
||||
|
||||
for (File file : archive.getFiles())
|
||||
for (FSFile file : archive.getFiles())
|
||||
{
|
||||
InventoryLoader loader = new InventoryLoader();
|
||||
InventoryDefinition inv = loader.load(file.getContents());
|
||||
|
||||
Files.write(gson.toJson(inv), new java.io.File(outDir, file.getFileId() + ".json"), Charset.defaultCharset());
|
||||
Files.write(gson.toJson(inv), new File(outDir, file.getFileId() + ".json"), Charset.defaultCharset());
|
||||
++count;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -33,6 +33,7 @@ import java.nio.charset.Charset;
|
||||
import net.runelite.cache.definitions.KitDefinition;
|
||||
import net.runelite.cache.definitions.loaders.KitLoader;
|
||||
import net.runelite.cache.fs.Archive;
|
||||
import net.runelite.cache.fs.FSFile;
|
||||
import net.runelite.cache.fs.Index;
|
||||
import net.runelite.cache.fs.Store;
|
||||
import org.junit.Rule;
|
||||
@@ -65,7 +66,7 @@ public class KitDumperTest
|
||||
|
||||
KitLoader loader = new KitLoader();
|
||||
|
||||
for (net.runelite.cache.fs.File file : archive.getFiles())
|
||||
for (FSFile file : archive.getFiles())
|
||||
{
|
||||
byte[] b = file.getContents();
|
||||
|
||||
|
||||
@@ -28,10 +28,11 @@ package net.runelite.cache;
|
||||
|
||||
import com.google.common.io.Files;
|
||||
import com.google.gson.Gson;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import net.runelite.cache.definitions.loaders.ModelLoader;
|
||||
import net.runelite.cache.fs.Archive;
|
||||
import net.runelite.cache.fs.File;
|
||||
import net.runelite.cache.fs.FSFile;
|
||||
import net.runelite.cache.fs.Index;
|
||||
import net.runelite.cache.fs.Store;
|
||||
import org.junit.Rule;
|
||||
@@ -52,7 +53,7 @@ public class ModelDumperTest
|
||||
@Test
|
||||
public void test() throws IOException
|
||||
{
|
||||
java.io.File modelDir = folder.newFolder("models");
|
||||
File modelDir = folder.newFolder("models");
|
||||
int count = 0;
|
||||
|
||||
try (Store store = new Store(StoreLocation.LOCATION))
|
||||
@@ -65,14 +66,14 @@ public class ModelDumperTest
|
||||
{
|
||||
assert archive.getFiles().size() == 1;
|
||||
|
||||
File file = archive.getFiles().get(0);
|
||||
FSFile file = archive.getFiles().get(0);
|
||||
byte[] contents = file.getContents();
|
||||
|
||||
ModelLoader loader = new ModelLoader();
|
||||
loader.load(archive.getArchiveId(), contents);
|
||||
|
||||
Files.write(contents, new java.io.File(modelDir, archive.getArchiveId() + ".model"));
|
||||
//Files.write(gson.toJson(loader), new java.io.File(modelDir, archive.getArchiveId() + ".json"), Charset.defaultCharset());
|
||||
Files.write(contents, new File(modelDir, archive.getArchiveId() + ".model"));
|
||||
//Files.write(gson.toJson(loader), new File(modelDir, archive.getArchiveId() + ".json"), Charset.defaultCharset());
|
||||
++count;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -27,12 +27,13 @@ package net.runelite.cache;
|
||||
import com.google.common.io.Files;
|
||||
import com.google.gson.Gson;
|
||||
import com.google.gson.GsonBuilder;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.nio.charset.Charset;
|
||||
import net.runelite.cache.definitions.OverlayDefinition;
|
||||
import net.runelite.cache.definitions.loaders.OverlayLoader;
|
||||
import net.runelite.cache.fs.Archive;
|
||||
import net.runelite.cache.fs.File;
|
||||
import net.runelite.cache.fs.FSFile;
|
||||
import net.runelite.cache.fs.Index;
|
||||
import net.runelite.cache.fs.Store;
|
||||
import org.junit.Rule;
|
||||
@@ -53,7 +54,7 @@ public class OverlayDumper
|
||||
@Test
|
||||
public void extract() throws IOException
|
||||
{
|
||||
java.io.File base = StoreLocation.LOCATION,
|
||||
File base = StoreLocation.LOCATION,
|
||||
outDir = folder.newFolder();
|
||||
|
||||
int count = 0;
|
||||
@@ -65,12 +66,12 @@ public class OverlayDumper
|
||||
Index index = store.getIndex(IndexType.CONFIGS);
|
||||
Archive archive = index.getArchive(ConfigType.OVERLAY.getId());
|
||||
|
||||
for (File file : archive.getFiles())
|
||||
for (FSFile file : archive.getFiles())
|
||||
{
|
||||
OverlayLoader loader = new OverlayLoader();
|
||||
OverlayDefinition overlay = loader.load(file.getFileId(), file.getContents());
|
||||
|
||||
Files.write(gson.toJson(overlay), new java.io.File(outDir, file.getFileId() + ".json"), Charset.defaultCharset());
|
||||
Files.write(gson.toJson(overlay), new File(outDir, file.getFileId() + ".json"), Charset.defaultCharset());
|
||||
++count;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -27,12 +27,13 @@ package net.runelite.cache;
|
||||
import com.google.common.io.Files;
|
||||
import com.google.gson.Gson;
|
||||
import com.google.gson.GsonBuilder;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.nio.charset.Charset;
|
||||
import net.runelite.cache.definitions.SequenceDefinition;
|
||||
import net.runelite.cache.definitions.loaders.SequenceLoader;
|
||||
import net.runelite.cache.fs.Archive;
|
||||
import net.runelite.cache.fs.File;
|
||||
import net.runelite.cache.fs.FSFile;
|
||||
import net.runelite.cache.fs.Index;
|
||||
import net.runelite.cache.fs.Store;
|
||||
import net.runelite.cache.io.InputStream;
|
||||
@@ -54,7 +55,7 @@ public class SequenceDumper
|
||||
@Test
|
||||
public void extract() throws IOException
|
||||
{
|
||||
java.io.File base = StoreLocation.LOCATION,
|
||||
File base = StoreLocation.LOCATION,
|
||||
outDir = folder.newFolder();
|
||||
|
||||
int count = 0;
|
||||
@@ -66,12 +67,12 @@ public class SequenceDumper
|
||||
Index index = store.getIndex(IndexType.CONFIGS);
|
||||
Archive archive = index.getArchive(ConfigType.SEQUENCE.getId());
|
||||
|
||||
for (File file : archive.getFiles())
|
||||
for (FSFile file : archive.getFiles())
|
||||
{
|
||||
SequenceLoader loader = new SequenceLoader();
|
||||
SequenceDefinition seq = loader.load(file.getFileId(), file.getContents());
|
||||
|
||||
Files.write(gson.toJson(seq), new java.io.File(outDir, file.getFileId() + ".json"), Charset.defaultCharset());
|
||||
Files.write(gson.toJson(seq), new File(outDir, file.getFileId() + ".json"), Charset.defaultCharset());
|
||||
++count;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -33,6 +33,7 @@ import java.nio.charset.Charset;
|
||||
import net.runelite.cache.definitions.loaders.sound.SoundEffectLoader;
|
||||
import net.runelite.cache.definitions.sound.SoundEffectDefinition;
|
||||
import net.runelite.cache.fs.Archive;
|
||||
import net.runelite.cache.fs.FSFile;
|
||||
import net.runelite.cache.fs.Index;
|
||||
import net.runelite.cache.fs.Store;
|
||||
import org.junit.Rule;
|
||||
@@ -66,7 +67,7 @@ public class SoundEffectsDumperTest
|
||||
{
|
||||
assert archive.getFiles().size() == 1;
|
||||
|
||||
net.runelite.cache.fs.File file = archive.getFiles().get(0);
|
||||
FSFile file = archive.getFiles().get(0);
|
||||
|
||||
SoundEffectLoader soundEffectLoader = new SoundEffectLoader();
|
||||
SoundEffectDefinition soundEffect = soundEffectLoader.load(file.getContents());
|
||||
|
||||
@@ -27,6 +27,7 @@ package net.runelite.cache;
|
||||
import com.google.common.io.Files;
|
||||
import com.google.gson.Gson;
|
||||
import com.google.gson.GsonBuilder;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.nio.charset.Charset;
|
||||
import net.runelite.cache.definitions.TextureDefinition;
|
||||
@@ -49,7 +50,7 @@ public class TextureDumper
|
||||
@Test
|
||||
public void extract() throws IOException
|
||||
{
|
||||
java.io.File base = StoreLocation.LOCATION,
|
||||
File base = StoreLocation.LOCATION,
|
||||
outDir = folder.newFolder();
|
||||
|
||||
int count = 0;
|
||||
@@ -63,7 +64,7 @@ public class TextureDumper
|
||||
|
||||
for (TextureDefinition texture : tm.getTextures())
|
||||
{
|
||||
Files.write(gson.toJson(texture), new java.io.File(outDir, texture.getId() + ".json"), Charset.defaultCharset());
|
||||
Files.write(gson.toJson(texture), new File(outDir, texture.getId() + ".json"), Charset.defaultCharset());
|
||||
++count;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -25,10 +25,11 @@
|
||||
|
||||
package net.runelite.cache;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.nio.file.Files;
|
||||
import net.runelite.cache.fs.Archive;
|
||||
import net.runelite.cache.fs.File;
|
||||
import net.runelite.cache.fs.FSFile;
|
||||
import net.runelite.cache.fs.Index;
|
||||
import net.runelite.cache.fs.Store;
|
||||
import org.junit.Rule;
|
||||
@@ -47,7 +48,7 @@ public class TitleDumper
|
||||
@Test
|
||||
public void extract() throws IOException
|
||||
{
|
||||
java.io.File base = StoreLocation.LOCATION,
|
||||
File base = StoreLocation.LOCATION,
|
||||
outFile = folder.newFolder();
|
||||
|
||||
try (Store store = new Store(base))
|
||||
@@ -56,7 +57,7 @@ public class TitleDumper
|
||||
|
||||
Index index = store.getIndex(IndexType.BINARY);
|
||||
Archive a = index.findArchiveByName("title.jpg");
|
||||
File file = a.getFiles().get(0);
|
||||
FSFile file = a.getFiles().get(0);
|
||||
|
||||
Files.write(outFile.toPath(), file.getContents());
|
||||
}
|
||||
|
||||
@@ -33,6 +33,7 @@ import javax.sound.midi.Sequencer;
|
||||
import net.runelite.cache.definitions.TrackDefinition;
|
||||
import net.runelite.cache.definitions.loaders.TrackLoader;
|
||||
import net.runelite.cache.fs.Archive;
|
||||
import net.runelite.cache.fs.FSFile;
|
||||
import net.runelite.cache.fs.Index;
|
||||
import net.runelite.cache.fs.Store;
|
||||
import net.runelite.cache.util.Djb2Manager;
|
||||
@@ -88,7 +89,7 @@ public class TrackDumperTest
|
||||
{
|
||||
assert archive.getFiles().size() == 1;
|
||||
|
||||
net.runelite.cache.fs.File file = archive.getFiles().get(0);
|
||||
FSFile file = archive.getFiles().get(0);
|
||||
|
||||
TrackLoader loader = new TrackLoader();
|
||||
TrackDefinition def = loader.load(file.getContents());
|
||||
|
||||
@@ -27,12 +27,13 @@ package net.runelite.cache;
|
||||
import com.google.common.io.Files;
|
||||
import com.google.gson.Gson;
|
||||
import com.google.gson.GsonBuilder;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.nio.charset.Charset;
|
||||
import net.runelite.cache.definitions.UnderlayDefinition;
|
||||
import net.runelite.cache.definitions.loaders.UnderlayLoader;
|
||||
import net.runelite.cache.fs.Archive;
|
||||
import net.runelite.cache.fs.File;
|
||||
import net.runelite.cache.fs.FSFile;
|
||||
import net.runelite.cache.fs.Index;
|
||||
import net.runelite.cache.fs.Store;
|
||||
import org.junit.Rule;
|
||||
@@ -53,7 +54,7 @@ public class UnderlayDumper
|
||||
@Test
|
||||
public void extract() throws IOException
|
||||
{
|
||||
java.io.File base = StoreLocation.LOCATION,
|
||||
File base = StoreLocation.LOCATION,
|
||||
outDir = folder.newFolder();
|
||||
|
||||
int count = 0;
|
||||
@@ -65,12 +66,12 @@ public class UnderlayDumper
|
||||
Index index = store.getIndex(IndexType.CONFIGS);
|
||||
Archive archive = index.getArchive(ConfigType.UNDERLAY.getId());
|
||||
|
||||
for (File file : archive.getFiles())
|
||||
for (FSFile file : archive.getFiles())
|
||||
{
|
||||
UnderlayLoader loader = new UnderlayLoader();
|
||||
UnderlayDefinition underlay = loader.load(file.getFileId(), file.getContents());
|
||||
|
||||
Files.write(gson.toJson(underlay), new java.io.File(outDir, file.getFileId() + ".json"), Charset.defaultCharset());
|
||||
Files.write(gson.toJson(underlay), new File(outDir, file.getFileId() + ".json"), Charset.defaultCharset());
|
||||
++count;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -33,6 +33,7 @@ import java.nio.charset.Charset;
|
||||
import net.runelite.cache.definitions.VarbitDefinition;
|
||||
import net.runelite.cache.definitions.loaders.VarbitLoader;
|
||||
import net.runelite.cache.fs.Archive;
|
||||
import net.runelite.cache.fs.FSFile;
|
||||
import net.runelite.cache.fs.Index;
|
||||
import net.runelite.cache.fs.Store;
|
||||
import org.junit.Rule;
|
||||
@@ -65,7 +66,7 @@ public class VarbitDumper
|
||||
Index index = store.getIndex(IndexType.CONFIGS);
|
||||
Archive archive = index.getArchive(ConfigType.VARBIT.getId());
|
||||
|
||||
for (net.runelite.cache.fs.File file : archive.getFiles())
|
||||
for (FSFile file : archive.getFiles())
|
||||
{
|
||||
VarbitLoader loader = new VarbitLoader();
|
||||
VarbitDefinition varbit = loader.load(file.getFileId(), file.getContents());
|
||||
|
||||
@@ -33,6 +33,7 @@ import java.nio.charset.Charset;
|
||||
import net.runelite.cache.definitions.WorldMapDefinition;
|
||||
import net.runelite.cache.definitions.loaders.WorldMapLoader;
|
||||
import net.runelite.cache.fs.Archive;
|
||||
import net.runelite.cache.fs.FSFile;
|
||||
import net.runelite.cache.fs.Index;
|
||||
import net.runelite.cache.fs.Store;
|
||||
import org.junit.Rule;
|
||||
@@ -65,7 +66,7 @@ public class WorldMapDumperTest
|
||||
Index index = store.getIndex(IndexType.WORLDMAP);
|
||||
Archive archive = index.getArchive(0); // there is also archive 1/2, but their data format is not this
|
||||
|
||||
for (net.runelite.cache.fs.File file : archive.getFiles())
|
||||
for (FSFile file : archive.getFiles())
|
||||
{
|
||||
WorldMapLoader loader = new WorldMapLoader();
|
||||
WorldMapDefinition def = loader.load(file.getContents(), file.getFileId());
|
||||
|
||||
@@ -25,6 +25,7 @@
|
||||
package net.runelite.cache.fs;
|
||||
|
||||
import com.google.common.io.Files;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import net.runelite.cache.StoreLocation;
|
||||
import org.junit.Assert;
|
||||
@@ -56,10 +57,10 @@ public class StoreLoadTest
|
||||
{
|
||||
store.load();
|
||||
|
||||
java.io.File testStoreFile = folder.newFolder();
|
||||
for (java.io.File f : StoreLocation.LOCATION.listFiles())
|
||||
File testStoreFile = folder.newFolder();
|
||||
for (File f : StoreLocation.LOCATION.listFiles())
|
||||
{
|
||||
Files.copy(f, new java.io.File(testStoreFile, f.getName()));
|
||||
Files.copy(f, new File(testStoreFile, f.getName()));
|
||||
}
|
||||
|
||||
try (Store testStore = new Store(testStoreFile))
|
||||
@@ -80,7 +81,7 @@ public class StoreLoadTest
|
||||
@Ignore
|
||||
public void unpackStore() throws IOException
|
||||
{
|
||||
java.io.File base = StoreLocation.LOCATION;
|
||||
File base = StoreLocation.LOCATION;
|
||||
try (Store store = new Store(base))
|
||||
{
|
||||
store.load();
|
||||
@@ -95,7 +96,7 @@ public class StoreLoadTest
|
||||
{
|
||||
try (Store store = new Store(folder.newFolder()))
|
||||
{
|
||||
store.loadTree(new java.io.File("C:\\rs\\temp\\tree"));
|
||||
store.loadTree(new File("C:\\rs\\temp\\tree"));
|
||||
|
||||
try (Store store2 = new Store(StoreLocation.LOCATION))
|
||||
{
|
||||
@@ -110,10 +111,10 @@ public class StoreLoadTest
|
||||
@Ignore
|
||||
public void saveTree() throws IOException
|
||||
{
|
||||
try (Store store = new Store(new java.io.File("d:/rs/07/temp/cache")))
|
||||
try (Store store = new Store(new File("d:/rs/07/temp/cache")))
|
||||
{
|
||||
store.load();
|
||||
store.saveTree(new java.io.File("d:/rs/07/temp/tree"));
|
||||
store.saveTree(new File("d:/rs/07/temp/tree"));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -24,6 +24,7 @@
|
||||
*/
|
||||
package net.runelite.cache.fs;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.util.Random;
|
||||
import net.runelite.cache.StoreLocation;
|
||||
@@ -46,7 +47,7 @@ public class StoreTest
|
||||
{
|
||||
Index index = store.addIndex(0);
|
||||
Archive archive = index.addArchive(0);
|
||||
File file = archive.addFile(0);
|
||||
FSFile file = archive.addFile(0);
|
||||
file.setNameHash(7);
|
||||
file.setContents("test".getBytes());
|
||||
|
||||
@@ -65,7 +66,7 @@ public class StoreTest
|
||||
public void testManyFiles() throws IOException
|
||||
{
|
||||
Random random = new Random(42L);
|
||||
java.io.File root = folder.newFolder();
|
||||
File root = folder.newFolder();
|
||||
|
||||
try (Store store = new Store(root))
|
||||
{
|
||||
@@ -75,7 +76,7 @@ public class StoreTest
|
||||
|
||||
for (int i = 0; i < NUMBER_OF_FILES; ++i)
|
||||
{
|
||||
File file = archive.addFile(i);
|
||||
FSFile file = archive.addFile(i);
|
||||
file.setNameHash(random.nextInt());
|
||||
byte[] data = new byte[random.nextInt(1024)];
|
||||
random.nextBytes(data);
|
||||
@@ -97,7 +98,7 @@ public class StoreTest
|
||||
public void testMultipleArchives() throws IOException
|
||||
{
|
||||
Random random = new Random(43L);
|
||||
java.io.File root = folder.newFolder();
|
||||
File root = folder.newFolder();
|
||||
|
||||
try (Store store = new Store(root))
|
||||
{
|
||||
@@ -113,7 +114,7 @@ public class StoreTest
|
||||
|
||||
for (int i = 0; i < NUMBER_OF_FILES; ++i)
|
||||
{
|
||||
File file = archive.addFile(i);
|
||||
FSFile file = archive.addFile(i);
|
||||
file.setNameHash(random.nextInt(Integer.MAX_VALUE));
|
||||
byte[] data = new byte[random.nextInt(1024)];
|
||||
random.nextBytes(data);
|
||||
@@ -122,7 +123,7 @@ public class StoreTest
|
||||
|
||||
for (int i = 0; i < NUMBER_OF_FILES; ++i)
|
||||
{
|
||||
File file = archive2.addFile(i);
|
||||
FSFile file = archive2.addFile(i);
|
||||
file.setNameHash(random.nextInt(Integer.MAX_VALUE));
|
||||
byte[] data = new byte[random.nextInt(1024)];
|
||||
random.nextBytes(data);
|
||||
@@ -131,7 +132,7 @@ public class StoreTest
|
||||
|
||||
for (int i = 0; i < NUMBER_OF_FILES; ++i)
|
||||
{
|
||||
File file = archive3.addFile(i);
|
||||
FSFile file = archive3.addFile(i);
|
||||
file.setNameHash(random.nextInt(Integer.MAX_VALUE));
|
||||
byte[] data = new byte[random.nextInt(1024)];
|
||||
random.nextBytes(data);
|
||||
@@ -148,7 +149,7 @@ public class StoreTest
|
||||
}
|
||||
|
||||
// Test tree save/load
|
||||
java.io.File tree = folder.newFolder();
|
||||
File tree = folder.newFolder();
|
||||
store.saveTree(tree);
|
||||
|
||||
try (Store store2 = new Store(folder.newFolder()))
|
||||
|
||||
@@ -25,13 +25,14 @@
|
||||
package net.runelite.cache.script.disassembler;
|
||||
|
||||
import com.google.common.io.Files;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import net.runelite.cache.IndexType;
|
||||
import net.runelite.cache.StoreLocation;
|
||||
import net.runelite.cache.definitions.ScriptDefinition;
|
||||
import net.runelite.cache.definitions.loaders.ScriptLoader;
|
||||
import net.runelite.cache.fs.Archive;
|
||||
import net.runelite.cache.fs.File;
|
||||
import net.runelite.cache.fs.FSFile;
|
||||
import net.runelite.cache.fs.Index;
|
||||
import net.runelite.cache.fs.Store;
|
||||
import net.runelite.cache.script.Instructions;
|
||||
@@ -51,7 +52,7 @@ public class DisassemblerTest
|
||||
@Test
|
||||
public void test() throws IOException
|
||||
{
|
||||
java.io.File outDir = folder.newFolder();
|
||||
File outDir = folder.newFolder();
|
||||
int count = 0;
|
||||
|
||||
Instructions.init();
|
||||
@@ -67,12 +68,12 @@ public class DisassemblerTest
|
||||
{
|
||||
assert archive.getFiles().size() == 1;
|
||||
|
||||
File file = archive.getFiles().get(0);
|
||||
FSFile file = archive.getFiles().get(0);
|
||||
byte[] contents = file.getContents();
|
||||
|
||||
ScriptDefinition script = loader.load(file.getFileId(), contents);
|
||||
|
||||
java.io.File outFile = new java.io.File(outDir, archive.getArchiveId() + ".rs2asm");
|
||||
File outFile = new File(outDir, archive.getArchiveId() + ".rs2asm");
|
||||
|
||||
Disassembler disassembler = new Disassembler();
|
||||
String out = disassembler.disassemble(script);
|
||||
|
||||
@@ -24,11 +24,12 @@
|
||||
*/
|
||||
package net.runelite.cache.server;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileNotFoundException;
|
||||
import net.runelite.cache.StoreLocation;
|
||||
import net.runelite.cache.client.CacheClient;
|
||||
import net.runelite.cache.fs.Archive;
|
||||
import net.runelite.cache.fs.File;
|
||||
import net.runelite.cache.fs.FSFile;
|
||||
import net.runelite.cache.fs.Index;
|
||||
import net.runelite.cache.fs.Store;
|
||||
import org.junit.Assert;
|
||||
@@ -49,7 +50,7 @@ public class CacheServerTest
|
||||
@Ignore
|
||||
public void run() throws Exception
|
||||
{
|
||||
try (Store store = new Store(new java.io.File("D:\\rs\\07\\temp\\cache139"));
|
||||
try (Store store = new Store(new File("D:\\rs\\07\\temp\\cache139"));
|
||||
CacheServer server = new CacheServer(store, REVISION))
|
||||
{
|
||||
store.load();
|
||||
@@ -103,7 +104,7 @@ public class CacheServerTest
|
||||
Archive archive = index.getArchive(0);
|
||||
archive.decompressAndLoad(null); // cache client doesn't decompress archive
|
||||
|
||||
File file = archive.getFiles().get(0);
|
||||
FSFile file = archive.getFiles().get(0);
|
||||
Assert.assertArrayEquals("test".getBytes(), file.getContents());
|
||||
}
|
||||
}
|
||||
@@ -113,7 +114,7 @@ public class CacheServerTest
|
||||
{
|
||||
Index index = store.addIndex(0);
|
||||
Archive archive = index.addArchive(0);
|
||||
File file = archive.addFile(0);
|
||||
FSFile file = archive.addFile(0);
|
||||
file.setNameHash(7);
|
||||
file.setContents("test".getBytes());
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user