Move rs-client related classes to own package
To properly differentiate between client loading logic, move these classes to own package. Signed-off-by: Tomas Slusny <slusnucky@gmail.com>
This commit is contained in:
@@ -52,6 +52,8 @@ import net.runelite.client.game.ClanManager;
|
||||
import net.runelite.client.game.ItemManager;
|
||||
import net.runelite.client.menus.MenuManager;
|
||||
import net.runelite.client.plugins.PluginManager;
|
||||
import net.runelite.client.rs.ClientLoader;
|
||||
import net.runelite.client.rs.ClientUpdateCheckMode;
|
||||
import net.runelite.client.ui.ClientUI;
|
||||
import net.runelite.client.ui.DrawManager;
|
||||
import net.runelite.client.ui.TitleToolbar;
|
||||
@@ -150,15 +152,15 @@ public class RuneLite
|
||||
parser.accepts("developer-mode", "Enable developer tools");
|
||||
parser.accepts("debug", "Show extra debugging output");
|
||||
|
||||
final ArgumentAcceptingOptionSpec<UpdateCheckMode> updateMode = parser
|
||||
final ArgumentAcceptingOptionSpec<ClientUpdateCheckMode> updateMode = parser
|
||||
.accepts("rs", "Select client type")
|
||||
.withRequiredArg()
|
||||
.ofType(UpdateCheckMode.class)
|
||||
.defaultsTo(UpdateCheckMode.AUTO)
|
||||
.withValuesConvertedBy(new EnumConverter<UpdateCheckMode>(UpdateCheckMode.class)
|
||||
.ofType(ClientUpdateCheckMode.class)
|
||||
.defaultsTo(ClientUpdateCheckMode.AUTO)
|
||||
.withValuesConvertedBy(new EnumConverter<ClientUpdateCheckMode>(ClientUpdateCheckMode.class)
|
||||
{
|
||||
@Override
|
||||
public UpdateCheckMode convert(String v)
|
||||
public ClientUpdateCheckMode convert(String v)
|
||||
{
|
||||
return super.convert(v.toUpperCase());
|
||||
}
|
||||
@@ -207,7 +209,7 @@ public class RuneLite
|
||||
injector.getInstance(RuneLite.class).start(getOptions().valueOf(updateMode));
|
||||
}
|
||||
|
||||
public void start(UpdateCheckMode updateMode) throws Exception
|
||||
public void start(ClientUpdateCheckMode updateMode) throws Exception
|
||||
{
|
||||
// Load RuneLite or Vanilla client
|
||||
final Applet client = new ClientLoader().loadRs(updateMode);
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
package net.runelite.client;
|
||||
package net.runelite.client.rs;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.IOException;
|
||||
@@ -34,7 +34,7 @@ import okhttp3.HttpUrl;
|
||||
import okhttp3.Request;
|
||||
import okhttp3.Response;
|
||||
|
||||
public class ConfigLoader
|
||||
public class ClientConfigLoader
|
||||
{
|
||||
private static final HttpUrl CONFIG_URL = HttpUrl.parse("http://oldschool.runescape.com/jav_config.ws"); // https redirects us to rs3
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
package net.runelite.client;
|
||||
package net.runelite.client.rs;
|
||||
|
||||
import java.applet.Applet;
|
||||
import java.io.IOException;
|
||||
@@ -34,14 +34,14 @@ import net.runelite.http.api.updatecheck.UpdateCheckClient;
|
||||
@Slf4j
|
||||
public class ClientLoader
|
||||
{
|
||||
public Applet loadRs(UpdateCheckMode updateMode)
|
||||
public Applet loadRs(ClientUpdateCheckMode updateMode)
|
||||
{
|
||||
if (updateMode == UpdateCheckMode.AUTO)
|
||||
if (updateMode == ClientUpdateCheckMode.AUTO)
|
||||
{
|
||||
final UpdateCheckClient updateCheck = new UpdateCheckClient();
|
||||
updateMode = updateCheck.isOutdated() ?
|
||||
UpdateCheckMode.VANILLA :
|
||||
UpdateCheckMode.RUNELITE;
|
||||
ClientUpdateCheckMode.VANILLA :
|
||||
ClientUpdateCheckMode.RUNELITE;
|
||||
}
|
||||
|
||||
try
|
||||
@@ -74,11 +74,11 @@ public class ClientLoader
|
||||
|
||||
private Applet loadRuneLite() throws ClassNotFoundException, IOException, InstantiationException, IllegalAccessException
|
||||
{
|
||||
ConfigLoader config = new ConfigLoader();
|
||||
ClientConfigLoader config = new ClientConfigLoader();
|
||||
|
||||
config.fetch();
|
||||
|
||||
String initialClass = config.getProperty(ConfigLoader.INITIAL_CLASS).replace(".class", "");
|
||||
String initialClass = config.getProperty(ClientConfigLoader.INITIAL_CLASS).replace(".class", "");
|
||||
|
||||
// the injected client is a runtime scoped dependency
|
||||
Class<?> clientClass = this.getClass().getClassLoader().loadClass(initialClass);
|
||||
@@ -91,13 +91,13 @@ public class ClientLoader
|
||||
|
||||
private Applet loadVanilla() throws IOException, ClassNotFoundException, InstantiationException, IllegalAccessException
|
||||
{
|
||||
ConfigLoader config = new ConfigLoader();
|
||||
ClientConfigLoader config = new ClientConfigLoader();
|
||||
|
||||
config.fetch();
|
||||
|
||||
String codebase = config.getProperty(ConfigLoader.CODEBASE);
|
||||
String initialJar = config.getProperty(ConfigLoader.INITIAL_JAR);
|
||||
String initialClass = config.getProperty(ConfigLoader.INITIAL_CLASS).replace(".class", "");
|
||||
String codebase = config.getProperty(ClientConfigLoader.CODEBASE);
|
||||
String initialJar = config.getProperty(ClientConfigLoader.INITIAL_JAR);
|
||||
String initialClass = config.getProperty(ClientConfigLoader.INITIAL_CLASS).replace(".class", "");
|
||||
|
||||
URL url = new URL(codebase + initialJar);
|
||||
|
||||
@@ -22,9 +22,9 @@
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
package net.runelite.client;
|
||||
package net.runelite.client.rs;
|
||||
|
||||
public enum UpdateCheckMode
|
||||
public enum ClientUpdateCheckMode
|
||||
{
|
||||
AUTO,
|
||||
NONE,
|
||||
@@ -23,7 +23,7 @@
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
package net.runelite.client;
|
||||
package net.runelite.client.rs;
|
||||
|
||||
import java.applet.AppletContext;
|
||||
import java.applet.AppletStub;
|
||||
@@ -32,9 +32,9 @@ import java.net.URL;
|
||||
|
||||
public class RSStub implements AppletStub
|
||||
{
|
||||
private final ConfigLoader config;
|
||||
private final ClientConfigLoader config;
|
||||
|
||||
public RSStub(ConfigLoader config)
|
||||
public RSStub(ClientConfigLoader config)
|
||||
{
|
||||
this.config = config;
|
||||
}
|
||||
@@ -56,7 +56,7 @@ public class RSStub implements AppletStub
|
||||
{
|
||||
try
|
||||
{
|
||||
return new URL(config.getProperty(ConfigLoader.CODEBASE));
|
||||
return new URL(config.getProperty(ClientConfigLoader.CODEBASE));
|
||||
}
|
||||
catch (MalformedURLException ex)
|
||||
{
|
||||
@@ -81,5 +81,5 @@ public class RSStub implements AppletStub
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -23,21 +23,22 @@
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
package net.runelite.client;
|
||||
package net.runelite.client.rs;
|
||||
|
||||
import java.io.IOException;
|
||||
import net.runelite.client.rs.ClientConfigLoader;
|
||||
import org.junit.Test;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Adam
|
||||
*/
|
||||
public class ConfigLoaderTest
|
||||
public class ClientConfigLoaderTest
|
||||
{
|
||||
@Test
|
||||
public void test() throws IOException
|
||||
{
|
||||
ConfigLoader loader = new ConfigLoader();
|
||||
ClientConfigLoader loader = new ClientConfigLoader();
|
||||
loader.fetch();
|
||||
|
||||
for (String key : loader.getProperties().keySet())
|
||||
Reference in New Issue
Block a user