Added support for resources

This commit is contained in:
JKetelaar
2015-09-13 23:44:04 +02:00
parent 5bdfbb22df
commit 1841485d32
415 changed files with 47 additions and 31 deletions
+1 -1
View File
@@ -6,7 +6,7 @@
<groupId>org.parabot</groupId> <groupId>org.parabot</groupId>
<artifactId>parabot-client</artifactId> <artifactId>parabot-client</artifactId>
<version>2.2</version> <version>2.2.3</version>
<packaging>jar</packaging> <packaging>jar</packaging>
@@ -21,5 +21,5 @@ public class Configuration {
public static final String DATA_API = "http://bdn.parabot.org/api/v2/data/"; public static final String DATA_API = "http://bdn.parabot.org/api/v2/data/";
public static final String ITEM_API = DATA_API + "items/"; public static final String ITEM_API = DATA_API + "items/";
public static final String BOT_VERSION = "2.2"; public static final String BOT_VERSION = "2.2.3";
} }
@@ -23,7 +23,7 @@ public class ProjectProperties {
String propertiesFileName = "/app.properties"; String propertiesFileName = "/app.properties";
Properties properties = new Properties(); Properties properties = new Properties();
InputStream inputStream = this.getClass().getClassLoader() InputStream inputStream = ProjectProperties.class.getClassLoader()
.getResourceAsStream(propertiesFileName); .getResourceAsStream(propertiesFileName);
cached.load(inputStream); cached.load(inputStream);
@@ -3,45 +3,57 @@ package org.parabot.core.asm.redirect;
import org.parabot.core.asm.RedirectClassAdapter; import org.parabot.core.asm.RedirectClassAdapter;
public class ThreadRedirect { public class ThreadRedirect {
private static int count = 0; private static int count = 0;
public static void start(Thread t){ public static void start(Thread t){
t.start(); t.start();
} }
public static void setPriority(Thread t,int i){ public static void setPriority(Thread t,int i){
t.setPriority(i); t.setPriority(i);
} }
public static void setDaemon(Thread t,boolean b){ public static void setDaemon(Thread t,boolean b){
t.setDaemon(b); t.setDaemon(b);
} }
public static void interrupt(Thread t){ public static void interrupt(Thread t){
t.interrupt(); t.interrupt();
} }
public static Thread currentThread(){ public static Thread currentThread(){
return null; return null;
} }
public static void join(Thread t) throws InterruptedException{
t.join();
}
public static void join(Thread t,long l) throws InterruptedException{
t.join(l);
}
public static void join(Thread t, long l,int i) throws InterruptedException{
t.join(l, i);
}
public static ClassLoader getContextClassLoader(Thread t){ public static ClassLoader getContextClassLoader(Thread t){
return null; return null;
} }
public static ThreadGroup getThreadGroup(Thread t){ public static ThreadGroup getThreadGroup(Thread t){
throw RedirectClassAdapter.createSecurityException(); throw RedirectClassAdapter.createSecurityException();
} }
public static void setName(Thread t, String name){ public static void setName(Thread t, String name){
t.setName(name); t.setName(name);
} }
public static String getName(Thread t){ public static String getName(Thread t){
return t.getName(); return t.getName();
} }
public static void sleep(long time) throws InterruptedException{ public static void sleep(long time) throws InterruptedException{
Thread.sleep(time); Thread.sleep(time);
} }
+3 -3
View File
@@ -84,15 +84,15 @@ public class BotUI extends JFrame implements ActionListener, ComponentListener,
JMenuItem exit = new JMenuItem("Exit"); JMenuItem exit = new JMenuItem("Exit");
run = new JMenuItem("Run"); run = new JMenuItem("Run");
run.setIcon(new ImageIcon(Images.getResource("/org/parabot/core/ui/images/run.png"))); run.setIcon(new ImageIcon(Images.getResource("/images/run.png")));
pause = new JMenuItem("Pause"); pause = new JMenuItem("Pause");
pause.setEnabled(false); pause.setEnabled(false);
pause.setIcon(new ImageIcon(Images.getResource("/org/parabot/core/ui/images/pause.png"))); pause.setIcon(new ImageIcon(Images.getResource("/images/pause.png")));
stop = new JMenuItem("Stop"); stop = new JMenuItem("Stop");
stop.setEnabled(false); stop.setEnabled(false);
stop.setIcon(new ImageIcon(Images.getResource("/org/parabot/core/ui/images/stop.png"))); stop.setIcon(new ImageIcon(Images.getResource("/images/stop.png")));
screenshot.addActionListener(this); screenshot.addActionListener(this);
proxy.addActionListener(this); proxy.addActionListener(this);
@@ -95,7 +95,7 @@ public class LoginUI extends JFrame {
RenderingHints.KEY_INTERPOLATION, RenderingHints.KEY_INTERPOLATION,
RenderingHints.VALUE_INTERPOLATION_BICUBIC); RenderingHints.VALUE_INTERPOLATION_BICUBIC);
g.drawImage(Images g.drawImage(Images
.getResource("/org/parabot/core/ui/images/para.png"), .getResource("/images/para.png"),
0, 8, 250, 45, null); 0, 8, 250, 45, null);
} }
}; };
@@ -51,7 +51,7 @@ public class VerboseLoader extends JPanel implements ProgressListener {
throw new IllegalStateException("MainScreenComponent already made."); throw new IllegalStateException("MainScreenComponent already made.");
} }
current = this; current = this;
this.background = Images.getResource("/org/parabot/core/ui/images/background.png"); this.background = Images.getResource("/images/background.png");
this.progressBar = new ProgressBar(400, 20); this.progressBar = new ProgressBar(400, 20);
setLayout(new GridBagLayout()); setLayout(new GridBagLayout());
setSize(775, 510); setSize(775, 510);
@@ -1,10 +1,9 @@
package org.parabot.core.ui.images; package org.parabot.core.ui.images;
import javax.imageio.ImageIO;
import java.awt.image.BufferedImage; import java.awt.image.BufferedImage;
import java.util.HashMap; import java.util.HashMap;
import javax.imageio.ImageIO;
/** /**
* *
* Caches and loads images from resource * Caches and loads images from resource
@@ -1,14 +1,13 @@
package org.parabot.core.ui.utils; package org.parabot.core.ui.utils;
import java.awt.Image;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import javax.swing.JFrame;
import org.parabot.core.ui.images.Images; import org.parabot.core.ui.images.Images;
import org.parabot.environment.OperatingSystem; import org.parabot.environment.OperatingSystem;
import javax.swing.*;
import java.awt.*;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
/** /**
* *
* Holds various swing util based methods * Holds various swing util based methods
@@ -30,7 +29,7 @@ public class SwingUtil {
} }
public static void setParabotIcons(JFrame f) { public static void setParabotIcons(JFrame f) {
f.setIconImage(Images.getResource("/org/parabot/core/ui/images/icon.png")); f.setIconImage(Images.getResource("/images/icon.png"));
if(OperatingSystem.getOS() == OperatingSystem.MAC) { if(OperatingSystem.getOS() == OperatingSystem.MAC) {
/** Adds the dock icon to mac users */ /** Adds the dock icon to mac users */
@@ -38,7 +37,7 @@ public class SwingUtil {
Class<?> util = Class.forName("com.apple.eawt.Application"); Class<?> util = Class.forName("com.apple.eawt.Application");
Object application = util.getMethod("getApplication", new Class[] { }).invoke(null); Object application = util.getMethod("getApplication", new Class[] { }).invoke(null);
Method setDockIconImage = util.getMethod("setDockIconImage", new Class[] { Image.class }); Method setDockIconImage = util.getMethod("setDockIconImage", new Class[] { Image.class });
setDockIconImage.invoke(application, Images.getResource("/org/parabot/core/ui/images/icon.png")); setDockIconImage.invoke(application, Images.getResource("/images/icon.png"));
} catch (ClassNotFoundException | NoSuchMethodException | InvocationTargetException | IllegalAccessException ignored) { } catch (ClassNotFoundException | NoSuchMethodException | InvocationTargetException | IllegalAccessException ignored) {
} catch (Throwable t) { } catch (Throwable t) {
t.printStackTrace(); t.printStackTrace();
@@ -33,7 +33,7 @@ public enum Category
*/ */
public static BufferedImage getIcon(String s) { public static BufferedImage getIcon(String s) {
if (images.get(s) == null) { if (images.get(s) == null) {
images.put(s, Images.getResource("/org/parabot/core/ui/images/category/" + s + ".png")); images.put(s, Images.getResource("/images/category/" + s + ".png"));
} }
return images.get(s); return images.get(s);
} }
@@ -52,7 +52,7 @@ public enum Category
private static HashMap<String, BufferedImage> images = new HashMap<>(); private static HashMap<String, BufferedImage> images = new HashMap<>();
static { static {
images.put("script", Images.getResource("/org/parabot/core/ui/images/category/script.png")); images.put("script", Images.getResource("/images/category/script.png"));
} }
} }
Binary file not shown.

After

Width:  |  Height:  |  Size: 152 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 299 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 332 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 331 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 325 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 489 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 357 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 371 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 307 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 311 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 611 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 343 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 328 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 431 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 371 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 452 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 668 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 354 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 276 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 310 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 377 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 76 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 125 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 155 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 110 B

Binary file not shown.
+1
View File
@@ -0,0 +1 @@
application.version=2.2.3
Binary file not shown.

After

Width:  |  Height:  |  Size: 152 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 299 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 332 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 331 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 325 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 489 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 357 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 371 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 307 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 311 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 611 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 343 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 328 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 431 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 371 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 452 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 668 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 354 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 276 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 310 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 377 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 76 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 125 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 155 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 110 B

Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.

Some files were not shown because too many files have changed in this diff Show More