injector: loadJar -> load, small cleanups in main

This commit is contained in:
TheRealNull
2021-01-02 04:16:57 -05:00
parent 099f89f1d0
commit cdd293a865
33 changed files with 64 additions and 68 deletions

View File

@@ -77,7 +77,7 @@ public class Deob
Stopwatch stopwatch = Stopwatch.createStarted();
ClassGroup group = JarUtil.loadJar(new File(args[0]));
ClassGroup group = JarUtil.load(new File(args[0]));
// remove except RuntimeException
run(group, new RuntimeExceptions());

View File

@@ -93,8 +93,8 @@ public class UpdateMappings
}
UpdateMappings u = new UpdateMappings(
JarUtil.loadJar(new File(args[0])),
JarUtil.loadJar(new File(args[1]))
JarUtil.load(new File(args[0])),
JarUtil.load(new File(args[1]))
);
u.update();
u.save(new File(args[2]));

View File

@@ -49,7 +49,7 @@ public class JarUtil
{
private static final Logger logger = LoggerFactory.getLogger(JarUtil.class);
public static ClassGroup loadJar(File jarfile) throws IOException
public static ClassGroup load(File jarfile)
{
ClassGroup group = new ClassGroup();
@@ -74,6 +74,10 @@ public class JarUtil
group.addClass(cv.getClassFile());
}
}
catch (IOException e)
{
e.printStackTrace();
}
group.initialize();

View File

@@ -39,7 +39,7 @@ public class ExecutionTest
@Test
public void test() throws Exception
{
ClassGroup group1 = JarUtil.loadJar(new File(properties.getVanillaClient()));
ClassGroup group1 = JarUtil.load(new File(properties.getVanillaClient()));
Execution e = new Execution(group1);
e.populateInitialMethods();
e.run();

View File

@@ -45,7 +45,7 @@ public class ClassFileVisitorTest
@Test
public void test() throws Exception
{
ClassGroup group = JarUtil.loadJar(new File(properties.getVanillaClient()));
ClassGroup group = JarUtil.load(new File(properties.getVanillaClient()));
JarUtil.saveJar(group, folder.newFile());
}

View File

@@ -50,7 +50,7 @@ public class EnumDeobfuscatorTest
@Before
public void before() throws IOException
{
group = JarUtil.loadJar(new File(properties.getRsClient()));
group = JarUtil.load(new File(properties.getRsClient()));
}
@After

View File

@@ -50,7 +50,7 @@ public class FieldInlinerTest
@Before
public void before() throws IOException
{
group = JarUtil.loadJar(new File(properties.getVanillaClient()));
group = JarUtil.load(new File(properties.getVanillaClient()));
}
@After

View File

@@ -50,7 +50,7 @@ public class IllegalStateExceptionsTest
@Before
public void before() throws IOException
{
group = JarUtil.loadJar(new File(properties.getVanillaClient()));
group = JarUtil.load(new File(properties.getVanillaClient()));
}
@After

View File

@@ -50,7 +50,7 @@ public class OrderTest
@Before
public void before() throws IOException
{
group = JarUtil.loadJar(new File(properties.getVanillaClient()));
group = JarUtil.load(new File(properties.getVanillaClient()));
}
@After

View File

@@ -50,7 +50,7 @@ public class PacketHandlerOrderTest
@Before
public void before() throws IOException
{
group = JarUtil.loadJar(new File(properties.getRsClient()));
group = JarUtil.load(new File(properties.getRsClient()));
}
@After

View File

@@ -58,7 +58,7 @@ public class RenameUniqueTest
@Before
public void before() throws IOException
{
group = JarUtil.loadJar(new File(properties.getVanillaClient()));
group = JarUtil.load(new File(properties.getVanillaClient()));
}
@After

View File

@@ -50,7 +50,7 @@ public class RuntimeExceptionsTest
@Before
public void before() throws IOException
{
group = JarUtil.loadJar(new File(properties.getVanillaClient()));
group = JarUtil.load(new File(properties.getVanillaClient()));
}
@After

View File

@@ -50,7 +50,7 @@ public class UnusedFieldsTest
@Before
public void before() throws IOException
{
group = JarUtil.loadJar(new File(properties.getVanillaClient()));
group = JarUtil.load(new File(properties.getVanillaClient()));
}
@After

View File

@@ -50,7 +50,7 @@ public class UnusedMethodsTest
@Before
public void before() throws IOException
{
group = JarUtil.loadJar(new File(properties.getVanillaClient()));
group = JarUtil.load(new File(properties.getVanillaClient()));
}
@After

View File

@@ -50,7 +50,7 @@ public class UnusedParametersTest
@Before
public void before() throws IOException
{
group = JarUtil.loadJar(new File(properties.getVanillaClient()));
group = JarUtil.load(new File(properties.getVanillaClient()));
}
@After

View File

@@ -51,7 +51,7 @@ public class ModArithTest
@Before
public void before() throws IOException
{
group = JarUtil.loadJar(new File(properties.getVanillaClient()));
group = JarUtil.load(new File(properties.getVanillaClient()));
}
@After

View File

@@ -51,7 +51,7 @@ public class MultiplyZeroDeobfuscatorTest
@Before
public void before() throws IOException
{
group = JarUtil.loadJar(new File(properties.getVanillaClient()));
group = JarUtil.load(new File(properties.getVanillaClient()));
}
@After

View File

@@ -50,7 +50,7 @@ public class ControlFlowDeobfuscatorTest
@Before
public void before() throws IOException
{
group = JarUtil.loadJar(new File(properties.getVanillaClient()));
group = JarUtil.load(new File(properties.getVanillaClient()));
}
@After

View File

@@ -50,7 +50,7 @@ public class ConstantParameterTest
@Before
public void before() throws IOException
{
group = JarUtil.loadJar(new File(properties.getVanillaClient()));
group = JarUtil.load(new File(properties.getVanillaClient()));
}
@After

View File

@@ -59,7 +59,7 @@ public class MappingDumper
@Before
public void before() throws IOException
{
group = JarUtil.loadJar(new File(properties.getRsClient()));
group = JarUtil.load(new File(properties.getRsClient()));
}
@Test
@@ -72,7 +72,7 @@ public class MappingDumper
@Test
public void dump() throws IOException
{
ClassGroup group = JarUtil.loadJar(new File(properties.getRsClient()));
ClassGroup group = JarUtil.load(new File(properties.getRsClient()));
final String GAP = "%-40s";
int classes = 0, methods = 0, fields = 0;
@@ -321,7 +321,7 @@ public class MappingDumper
@Test
public void dumpTiny() throws IOException
{
ClassGroup group = JarUtil.loadJar(new File(properties.getRsClient()));
ClassGroup group = JarUtil.load(new File(properties.getRsClient()));
System.out.println("v1\tofficial\tintermediary");
for (ClassFile clazz : group.getClasses())
{
@@ -379,7 +379,7 @@ public class MappingDumper
@Test
public void dumpJson() throws IOException
{
ClassGroup group = JarUtil.loadJar(new File(properties.getRsClient()));
ClassGroup group = JarUtil.load(new File(properties.getRsClient()));
Gson gson = new GsonBuilder().setPrettyPrinting().create();
JsonObject jObject = new JsonObject();

View File

@@ -50,7 +50,7 @@ public class MenuActionDeobfuscatorTest
@Before
public void before() throws IOException
{
group = JarUtil.loadJar(new File(properties.getRsClient()));
group = JarUtil.load(new File(properties.getRsClient()));
}
@After

View File

@@ -49,7 +49,7 @@ public class PacketTypeFinderTest
@Before
public void before() throws IOException
{
group = JarUtil.loadJar(new File(properties.getRsClient()));
group = JarUtil.load(new File(properties.getRsClient()));
}
@Test

View File

@@ -51,7 +51,7 @@ public class PacketWriteDeobfuscatorTest
@Before
public void before() throws IOException
{
group = JarUtil.loadJar(new File(properties.getRsClient()));
group = JarUtil.load(new File(properties.getRsClient()));
group.removeClass(group.findClass("net/runelite/rs/Reflection"));
}

View File

@@ -51,7 +51,7 @@ public class ClientErrorTransformerTest
@Before
public void before() throws IOException
{
group = JarUtil.loadJar(GAMEPACK);
group = JarUtil.load(GAMEPACK);
}
@After

View File

@@ -49,7 +49,7 @@ public class BufferFinderTest
@Before
public void before() throws IOException
{
group = JarUtil.loadJar(new File(properties.getRsClient()));
group = JarUtil.load(new File(properties.getRsClient()));
}
@Test

View File

@@ -31,7 +31,7 @@ public class AnnotationCleaner
{
final List<String> missing = new ArrayList<>();
File client = new File(properties.getRsClient());
ClassGroup group = JarUtil.loadJar(client);
ClassGroup group = JarUtil.load(client);
for (ClassFile c : group.getClasses())
{
@@ -113,7 +113,7 @@ public class AnnotationCleaner
{
File client = new File(properties.getRsClient());
ClassGroup group = JarUtil.loadJar(client);
ClassGroup group = JarUtil.load(client);
new AnnotationAdder(group).run();

View File

@@ -47,8 +47,8 @@ public class AnnotationCopierTest
@Before
public void before() throws IOException
{
group1 = JarUtil.loadJar(new File(JAR1));
group2 = JarUtil.loadJar(new File(JAR2));
group1 = JarUtil.load(new File(JAR1));
group2 = JarUtil.load(new File(JAR2));
}
@After

View File

@@ -42,7 +42,7 @@ public class AnnotationRenamerTest
@Before
public void before() throws IOException
{
group = JarUtil.loadJar(new File(JAR));
group = JarUtil.load(new File(JAR));
}
@After

View File

@@ -62,8 +62,8 @@ public class UpdateMappingsTest
{
File client = new File(properties.getRsClient());
ClassGroup group1 = JarUtil.loadJar(client);
ClassGroup group2 = JarUtil.loadJar(new File(JAR));
ClassGroup group1 = JarUtil.load(client);
ClassGroup group2 = JarUtil.load(new File(JAR));
map(group1, group2);
@@ -76,8 +76,8 @@ public class UpdateMappingsTest
{
File client = new File(properties.getRsClient());
ClassGroup group1 = JarUtil.loadJar(client);
ClassGroup group2 = JarUtil.loadJar(client);
ClassGroup group1 = JarUtil.load(client);
ClassGroup group2 = JarUtil.load(client);
// Remove existing annotations
unannotate(group2);
@@ -94,7 +94,7 @@ public class UpdateMappingsTest
{
File client = new File("C:\\Users\\Lucas\\IdeaProjects\\runelitexxx\\client.jar");
ClassGroup group = JarUtil.loadJar(client);
ClassGroup group = JarUtil.load(client);
new ScriptOpcodesTransformer().transform(group);

View File

@@ -72,7 +72,7 @@ public class HookImporter
java.lang.reflect.Type type = new TypeToken<Map<String, ClassHook>>() {}.getType();
hooks = gson.fromJson(new InputStreamReader(is), type);
group = JarUtil.loadJar(IN);
group = JarUtil.load(IN);
}
@After

View File

@@ -64,7 +64,7 @@ public class MappingImporter
@Before
public void before() throws IOException
{
group = JarUtil.loadJar(IN);
group = JarUtil.load(IN);
}
@After

View File

@@ -75,7 +75,7 @@ public class HookImporter
@Before
public void before() throws IOException
{
group = JarUtil.loadJar(new File(properties.getRsClient()));
group = JarUtil.load(new File(properties.getRsClient()));
InputStream is = getClass().getResourceAsStream("hooks.json");
Gson gson = new Gson();