cache: rename File to FSFile
This commit is contained in:
@@ -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