Search in sources :

Example 1 with CanvasInjector

use of os.rs.paint.CanvasInjector in project OSJR by zeruth.

the class JarInjector method run.

public void run() {
    classnodes = new CanvasInjector(classnodes).run();
    try {
        injectedJar = new File("./export/gamepack_injected.jar");
        JarOutputStream jos = new JarOutputStream(new FileOutputStream(injectedJar));
        for (ClassNode cn : classnodes.values()) {
            ClassWriter cw = new ClassWriter(1);
            cn.accept(cw);
            JarEntry entry = new JarEntry(cn.name + ".class");
            jos.putNextEntry(entry);
            jos.write(cw.toByteArray());
            jos.closeEntry();
        }
        jos.close();
    } catch (Exception e) {
        e.printStackTrace();
    }
}
Also used : ClassNode(jdk.internal.org.objectweb.asm.tree.ClassNode) FileOutputStream(java.io.FileOutputStream) CanvasInjector(os.rs.paint.CanvasInjector) JarOutputStream(java.util.jar.JarOutputStream) JarEntry(java.util.jar.JarEntry) File(java.io.File) ClassWriter(jdk.internal.org.objectweb.asm.ClassWriter)

Aggregations

File (java.io.File)1 FileOutputStream (java.io.FileOutputStream)1 JarEntry (java.util.jar.JarEntry)1 JarOutputStream (java.util.jar.JarOutputStream)1 ClassWriter (jdk.internal.org.objectweb.asm.ClassWriter)1 ClassNode (jdk.internal.org.objectweb.asm.tree.ClassNode)1 CanvasInjector (os.rs.paint.CanvasInjector)1