Would somebody please assist me in xbooting my Canvas. I don't know where to start here is what i have so far.
package org.kushbot;
import java.net.MalformedURLException;
import org.kushbot.loader.RSLoader;
import org.kushbot.ui.BotFrame;
public class Boot {
public static void main(String[]args) throws InstantiationException, IllegalAccessException, MalformedURLException, ClassNotFoundException{
new RSLoader();
new BotFrame();
}
}
import java.applet.Applet;
import java.applet.AppletContext;
import java.applet.AppletStub;
import java.io.BufferedInputStream;
import java.io.BufferedOutputStream;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileOutputStream;
import java.io.InputStreamReader;
import java.net.MalformedURLException;
import java.net.URL;
import java.net.URLClassLoader;
import java.util.HashMap;
public class RSLoader implements AppletStub {
private static final HashMap<String, String> PARAMETERS = new HashMap<String, String>();
private static final String LINK = "http://oldschool69.runescape.com/";
public static Applet applet;
static RSLoader r;
public RSLoader() throws InstantiationException, IllegalAccessException, MalformedURLException, ClassNotFoundException{
parse(LINK);
dwnld(LINK + PARAMETERS.get("archive"));
ClassLoader loader = new URLClassLoader(new URL[] { new File("Runescape.jar").toURI().toURL() });
Class<?> client = loader.loadClass("client");
applet = (Applet) client.newInstance();
applet.setStub(this);
applet.init();
applet.start();
}
public final String getParameter(String name) {
return PARAMETERS.get(name);
}
public final URL getDocumentBase() {
try {
return new URL(LINK);
} catch (MalformedURLException e) {
return null;
}
}
public final URL getCodeBase() {
try {
return new URL(LINK);
} catch (MalformedURLException e) {
return null;
}
}
public final AppletContext getAppletContext() {
return null;
}
private void parse(final String url) {
try {
BufferedReader in = new BufferedReader(new InputStreamReader(
new URL(url).openStream()));
String line;
while ((line = in.readLine()) != null) {
if (line.contains("app") && line.contains("write")) {
PARAMETERS.put("<app", "");
PARAMETERS.put("let ", "");
} else if (line.contains("scriptsrc") || line.contains("ie6")) {
} else if (line.contains("document.write")) {
line = line.replaceAll("document.write", "")
.replaceAll("<param name=\"", "")
.replaceAll("\">'", "\"").replaceAll("'", "")
.replaceAll("\\(", "").replaceAll("\\)", "")
.replaceAll("\"", "").replaceAll(" ", "")
.replaceAll(";", "").replaceAll("value", "");
String[] splitted = line.split("=");
if (splitted.length == 1) {
PARAMETERS.put(splitted[0], "");
} else if (splitted.length == 2) {
PARAMETERS.put(splitted[0], splitted[1]);
} else if (splitted.length == 3) {
PARAMETERS.put(splitted[0], splitted[1] + splitted[2]);
}
}
}
in.close();
} catch (Exception e) {
System.out.println("Error Parsing!");
}
}
private void dwnld(final String url) {
try {
BufferedInputStream in = new BufferedInputStream(
new URL(url).openStream());
FileOutputStream fos = new FileOutputStream("Runescape.jar");
BufferedOutputStream out = new BufferedOutputStream(fos, 1024);
byte[] data = new byte[1024];
int x;
while ((x = in.read(data, 0, 1024)) >= 0) {
out.write(data, 0, x);
}
in.close();
out.close();
} catch (Exception e) {
System.out.println("Error Downloading!");
}
}
@Override
public void appletResize(int width, int height) {
}
@Override
public boolean isActive() {
return false;
}
public Applet getClient() {
return applet;
}
public java.awt.Canvas getCanvas() {
return (java.awt.Canvas) applet.getComponent(0);
}
}
package org.kushbot.ui;
import java.awt.BorderLayout;
import javax.swing.JFrame;
import org.kushbot.loader.RSLoader;
public class BotFrame extends JFrame {
public BotFrame() {
setTitle("RuneDream");
add(RSLoader.applet, BorderLayout.CENTER);
setVisible(true);
setSize(775, 540);
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
}
}