Question marking hard at why travis is failing
This commit is contained in:
@@ -0,0 +1,22 @@
|
||||
package net.runelite.deob.deobfuscators.mapping.mappingdumper;
|
||||
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
import java.util.List;
|
||||
|
||||
public class MappedClass
|
||||
{
|
||||
@SerializedName("class")
|
||||
public String implementingName;
|
||||
@SerializedName("name")
|
||||
public String obfuscatedName;
|
||||
@SerializedName("super")
|
||||
public String superClass;
|
||||
public int access;
|
||||
public List<String> interfaces;
|
||||
public List<MappedField> fields;
|
||||
public List<MappedMethod> methods;
|
||||
public List<MappedMethod> constructors;
|
||||
// Static fields/methods belonging to this class (ClassName_name)
|
||||
public List<MappedField> staticFields;
|
||||
public List<MappedMethod> staticMethods;
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
package net.runelite.deob.deobfuscators.mapping.mappingdumper;
|
||||
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
|
||||
public class MappedField
|
||||
{
|
||||
@SerializedName("field")
|
||||
public String exportedName;
|
||||
public String owner;
|
||||
@SerializedName("name")
|
||||
public String obfuscatedName;
|
||||
public int access;
|
||||
public String descriptor;
|
||||
public Long decoder;
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
package net.runelite.deob.deobfuscators.mapping.mappingdumper;
|
||||
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
import java.util.List;
|
||||
|
||||
public class MappedMethod
|
||||
{
|
||||
@SerializedName("method")
|
||||
public String exportedName;
|
||||
public String owner;
|
||||
@SerializedName("name")
|
||||
public String obfuscatedName;
|
||||
public int access;
|
||||
public List<String> parameters;
|
||||
public String descriptor;
|
||||
public Long garbageValue;
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
package net.runelite.deob.deobfuscators.mapping.mappingdumper;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class MappingDump
|
||||
{
|
||||
public int revision;
|
||||
|
||||
public int totalClasses;
|
||||
public int totalNamedClasses;
|
||||
|
||||
public int totalFields;
|
||||
public int totalNamedFields;
|
||||
|
||||
public int totalNonStaticFields;
|
||||
public int totalNamedNonStaticFields;
|
||||
|
||||
public int totalStaticFields;
|
||||
public int totalNamedStaticFields;
|
||||
|
||||
public int totalMethods;
|
||||
public int totalNamedMethods;
|
||||
|
||||
public int totalNonStaticMethods;
|
||||
public int totalNamedNonStaticMethods;
|
||||
|
||||
public int totalStaticMethods;
|
||||
public int totalNamedStaticMethods;
|
||||
|
||||
public List<MappedClass> classes;
|
||||
|
||||
// Static things belonging to a certain class will be in both these lists and in the classes
|
||||
public List<MappedField> staticFields;
|
||||
public List<MappedMethod> staticMethods;
|
||||
}
|
||||
111
runescape-client/src/test/java/ConfigLoader.java
Normal file
111
runescape-client/src/test/java/ConfigLoader.java
Normal file
@@ -0,0 +1,111 @@
|
||||
/*
|
||||
* Copyright (c) 2016-2017, Adam <Adam@sigterm.info>
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice, this
|
||||
* list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
* this list of conditions and the following disclaimer in the documentation
|
||||
* and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
|
||||
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStreamReader;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
public class ConfigLoader
|
||||
{
|
||||
private static final Logger logger = LoggerFactory.getLogger(ConfigLoader.class);
|
||||
|
||||
private static final String CONFIG_RESOURCE = "/jav_config.ws";
|
||||
|
||||
public static final String CODEBASE = "codebase";
|
||||
public static final String INITIAL_JAR = "initial_jar";
|
||||
public static final String INITIAL_CLASS = "initial_class";
|
||||
public static final String APP_MINWIDTH = "applet_minwidth";
|
||||
public static final String APP_MINHEIGHT = "applet_minheight";
|
||||
|
||||
private final Map<String, String> properties = new HashMap<>(),
|
||||
appletProperties = new HashMap<>();
|
||||
|
||||
public void fetch() throws IOException
|
||||
{
|
||||
try (BufferedReader in = new BufferedReader(new InputStreamReader(getClass().getResourceAsStream(CONFIG_RESOURCE))))
|
||||
{
|
||||
String str;
|
||||
|
||||
while ((str = in.readLine()) != null)
|
||||
{
|
||||
int idx = str.indexOf('=');
|
||||
|
||||
if (idx == -1)
|
||||
continue;
|
||||
|
||||
String s = str.substring(0, idx);
|
||||
|
||||
if (s.equals("param"))
|
||||
{
|
||||
str = str.substring(idx + 1);
|
||||
idx = str.indexOf('=');
|
||||
s = str.substring(0, idx);
|
||||
|
||||
String value = str.substring(idx + 1);
|
||||
|
||||
appletProperties.put(s, value);
|
||||
|
||||
logger.info("Param: {} -> {}", s, value);
|
||||
}
|
||||
else if (s.equals("msg"))
|
||||
{
|
||||
// ignore
|
||||
}
|
||||
else
|
||||
{
|
||||
String value = str.substring(idx + 1);
|
||||
|
||||
properties.put(s, value);
|
||||
|
||||
logger.info("Property: {} -> {}", s, value);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public String getProperty(String name)
|
||||
{
|
||||
return properties.get(name);
|
||||
}
|
||||
|
||||
public Map<String, String> getProperties()
|
||||
{
|
||||
return properties;
|
||||
}
|
||||
|
||||
public String getAppletProperty(String name)
|
||||
{
|
||||
return appletProperties.get(name);
|
||||
}
|
||||
|
||||
public Map<String, String> getAppletProperties()
|
||||
{
|
||||
return appletProperties;
|
||||
}
|
||||
}
|
||||
54
runescape-client/src/test/java/ISAACCipherTest.java
Normal file
54
runescape-client/src/test/java/ISAACCipherTest.java
Normal file
@@ -0,0 +1,54 @@
|
||||
/*
|
||||
* Copyright (c) 2017, Adam <Adam@sigterm.info>
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice, this
|
||||
* list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
* this list of conditions and the following disclaimer in the documentation
|
||||
* and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
|
||||
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
import org.junit.Assert;
|
||||
import org.junit.Test;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Adam
|
||||
*/
|
||||
public class ISAACCipherTest
|
||||
{
|
||||
private static final int TEST_SIZE = 100;
|
||||
|
||||
@Test
|
||||
public void testNextInt()
|
||||
{
|
||||
int[] keyInts = new int[]
|
||||
{
|
||||
4, 8, 15, 16, 23, 42
|
||||
};
|
||||
|
||||
IsaacCipher is = new IsaacCipher(keyInts);
|
||||
|
||||
RLISAACCipher cipher = new RLISAACCipher(keyInts);
|
||||
|
||||
for (int i = 0; i < TEST_SIZE; ++i)
|
||||
{
|
||||
Assert.assertEquals(is.nextInt(), cipher.nextInt());
|
||||
}
|
||||
}
|
||||
}
|
||||
35
runescape-client/src/test/java/Main.java
Normal file
35
runescape-client/src/test/java/Main.java
Normal file
@@ -0,0 +1,35 @@
|
||||
|
||||
import java.io.IOException;
|
||||
import javax.swing.JFrame;
|
||||
import javax.swing.WindowConstants;
|
||||
|
||||
public class Main extends JFrame
|
||||
{
|
||||
private static final int WIDTH = 765;
|
||||
private static final int HEIGHT = 503;
|
||||
|
||||
public Main() throws IOException
|
||||
{
|
||||
this.setSize(800, 600);
|
||||
Client client = new Client();
|
||||
|
||||
ConfigLoader config = new ConfigLoader();
|
||||
config.fetch();
|
||||
|
||||
client.setStub(new RSStub(config, client));
|
||||
|
||||
this.add(client);
|
||||
|
||||
client.setSize(WIDTH, HEIGHT);
|
||||
|
||||
client.init();
|
||||
client.start();
|
||||
this.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
|
||||
this.setVisible(true);
|
||||
}
|
||||
|
||||
public static void main(String[] args) throws IOException
|
||||
{
|
||||
new Main();
|
||||
}
|
||||
}
|
||||
40
runescape-client/src/test/java/MainTest.java
Normal file
40
runescape-client/src/test/java/MainTest.java
Normal file
@@ -0,0 +1,40 @@
|
||||
/*
|
||||
* Copyright (c) 2016-2017, Adam <Adam@sigterm.info>
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice, this
|
||||
* list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
* this list of conditions and the following disclaimer in the documentation
|
||||
* and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
|
||||
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
import java.io.IOException;
|
||||
import org.junit.Test;
|
||||
|
||||
public class MainTest
|
||||
{
|
||||
//@Test
|
||||
public void test() throws IOException, InterruptedException
|
||||
{
|
||||
Main main = new Main();
|
||||
for (;;)
|
||||
{
|
||||
Thread.sleep(500L);
|
||||
}
|
||||
}
|
||||
}
|
||||
173
runescape-client/src/test/java/RLISAACCipher.java
Normal file
173
runescape-client/src/test/java/RLISAACCipher.java
Normal file
@@ -0,0 +1,173 @@
|
||||
/*
|
||||
* Copyright (c) 2017, Adam <Adam@sigterm.info>
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice, this
|
||||
* list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
* this list of conditions and the following disclaimer in the documentation
|
||||
* and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
|
||||
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
import java.util.Arrays;
|
||||
|
||||
/**
|
||||
* Based off of the implementation from
|
||||
* https://rosettacode.org/wiki/The_ISAAC_Cipher#Java Modified to not extend
|
||||
* java.util.Random, and return results in reverse order
|
||||
*
|
||||
* @author Adam
|
||||
*/
|
||||
public class RLISAACCipher
|
||||
{
|
||||
private final int[] randResult = new int[256]; // output of last generation
|
||||
private int valuesLeft; // the number of values already left in randResult
|
||||
|
||||
// internal generator state
|
||||
private final int[] mm = new int[256];
|
||||
private int aa, bb, cc;
|
||||
|
||||
public RLISAACCipher(int[] key)
|
||||
{
|
||||
init(key);
|
||||
}
|
||||
|
||||
private void generateMoreResults()
|
||||
{
|
||||
cc++;
|
||||
bb += cc;
|
||||
|
||||
for (int i = 0; i < 256; i++)
|
||||
{
|
||||
int x = mm[i];
|
||||
switch (i & 3)
|
||||
{
|
||||
case 0:
|
||||
aa = aa ^ (aa << 13);
|
||||
break;
|
||||
case 1:
|
||||
aa = aa ^ (aa >>> 6);
|
||||
break;
|
||||
case 2:
|
||||
aa = aa ^ (aa << 2);
|
||||
break;
|
||||
case 3:
|
||||
aa = aa ^ (aa >>> 16);
|
||||
break;
|
||||
}
|
||||
aa = mm[i ^ 128] + aa;
|
||||
int y = mm[i] = mm[(x >>> 2) & 0xFF] + aa + bb;
|
||||
randResult[i] = bb = mm[(y >>> 10) & 0xFF] + x;
|
||||
}
|
||||
|
||||
valuesLeft = 256;
|
||||
}
|
||||
|
||||
private static void mix(int[] s)
|
||||
{
|
||||
s[0] ^= s[1] << 11;
|
||||
s[3] += s[0];
|
||||
s[1] += s[2];
|
||||
s[1] ^= s[2] >>> 2;
|
||||
s[4] += s[1];
|
||||
s[2] += s[3];
|
||||
s[2] ^= s[3] << 8;
|
||||
s[5] += s[2];
|
||||
s[3] += s[4];
|
||||
s[3] ^= s[4] >>> 16;
|
||||
s[6] += s[3];
|
||||
s[4] += s[5];
|
||||
s[4] ^= s[5] << 10;
|
||||
s[7] += s[4];
|
||||
s[5] += s[6];
|
||||
s[5] ^= s[6] >>> 4;
|
||||
s[0] += s[5];
|
||||
s[6] += s[7];
|
||||
s[6] ^= s[7] << 8;
|
||||
s[1] += s[6];
|
||||
s[7] += s[0];
|
||||
s[7] ^= s[0] >>> 9;
|
||||
s[2] += s[7];
|
||||
s[0] += s[1];
|
||||
}
|
||||
|
||||
private void init(int[] seed)
|
||||
{
|
||||
if (seed != null && seed.length != 256)
|
||||
{
|
||||
seed = Arrays.copyOf(seed, 256);
|
||||
}
|
||||
aa = bb = cc = 0;
|
||||
int[] initState = new int[8];
|
||||
Arrays.fill(initState, 0x9e3779b9); // the golden ratio
|
||||
|
||||
for (int i = 0; i < 4; i++)
|
||||
{
|
||||
mix(initState);
|
||||
}
|
||||
|
||||
for (int i = 0; i < 256; i += 8)
|
||||
{
|
||||
if (seed != null)
|
||||
{
|
||||
for (int j = 0; j < 8; j++)
|
||||
{
|
||||
initState[j] += seed[i + j];
|
||||
}
|
||||
}
|
||||
|
||||
mix(initState);
|
||||
for (int j = 0; j < 8; j++)
|
||||
{
|
||||
mm[i + j] = initState[j];
|
||||
}
|
||||
}
|
||||
|
||||
if (seed != null)
|
||||
{
|
||||
for (int i = 0; i < 256; i += 8)
|
||||
{
|
||||
for (int j = 0; j < 8; j++)
|
||||
{
|
||||
initState[j] += mm[i + j];
|
||||
}
|
||||
|
||||
mix(initState);
|
||||
|
||||
for (int j = 0; j < 8; j++)
|
||||
{
|
||||
mm[i + j] = initState[j];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
valuesLeft = 0; // Make sure generateMoreResults() will be called by the next nextInt() call.
|
||||
}
|
||||
|
||||
public int nextInt()
|
||||
{
|
||||
if (valuesLeft == 0)
|
||||
{
|
||||
generateMoreResults();
|
||||
assert valuesLeft == 256;
|
||||
}
|
||||
|
||||
int value = randResult[--valuesLeft];
|
||||
|
||||
return value;
|
||||
}
|
||||
}
|
||||
90
runescape-client/src/test/java/RSStub.java
Normal file
90
runescape-client/src/test/java/RSStub.java
Normal file
@@ -0,0 +1,90 @@
|
||||
/*
|
||||
* Copyright (c) 2016-2017, Adam <Adam@sigterm.info>
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice, this
|
||||
* list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
* this list of conditions and the following disclaimer in the documentation
|
||||
* and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
|
||||
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
import java.applet.Applet;
|
||||
import java.applet.AppletContext;
|
||||
import java.applet.AppletStub;
|
||||
import java.awt.Dimension;
|
||||
import java.net.MalformedURLException;
|
||||
import java.net.URL;
|
||||
|
||||
public class RSStub implements AppletStub
|
||||
{
|
||||
private final ConfigLoader config;
|
||||
private final Applet app;
|
||||
|
||||
public RSStub(ConfigLoader config, Applet app)
|
||||
{
|
||||
this.config = config;
|
||||
this.app = app;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isActive()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public URL getDocumentBase()
|
||||
{
|
||||
return getCodeBase();
|
||||
}
|
||||
|
||||
@Override
|
||||
public URL getCodeBase()
|
||||
{
|
||||
try
|
||||
{
|
||||
return new URL(config.getProperty(ConfigLoader.CODEBASE));
|
||||
}
|
||||
catch (MalformedURLException ex)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getParameter(String name)
|
||||
{
|
||||
return config.getAppletProperty(name);
|
||||
}
|
||||
|
||||
@Override
|
||||
public AppletContext getAppletContext()
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void appletResize(int width, int height)
|
||||
{
|
||||
Dimension d = new Dimension(width, height);
|
||||
|
||||
app.setSize(d);
|
||||
app.setPreferredSize(d);
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user