private byte[] getGamepack() { try { System.out.println("Loading game environment."); game.load(); System.out.println("Successfully loaded game environment."); } catch (final IOException e) { System.out.println("Unable to load game environment."); e.printStackTrace(); return null; } try { System.out.println(); System.out.println("Downloading gamepack."); final String directGame = game.getDirectGame(); final byte[] data = Internet.downloadBinary( directGame.substring(0, directGame.indexOf(".com") + 5) + game.getArchive()); System.out.println("Successfully downloaded gamepack."); return data; } catch (final IOException e) { System.out.println("Unable to download gamepack."); e.printStackTrace(); return null; } }
private Map<String, byte[]> decryptGamepack(final byte[] gamepack) { System.out.println("Decrypting gamepack."); try { final Decrypter decrypter = new Decrypter(gamepack, game.getParameter("-1"), game.getParameter("0")); decrypter.decrypt(); System.out.println("Successfully decrypted gamepack."); return decrypter.getClasses(); } catch (final Exception e) { System.out.println("Unable to decrypt gamepack."); e.printStackTrace(); } return null; }