Advertisement
Guest User

Untitled

a guest
Jul 20th, 2017
55
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 4.06 KB | None | 0 0
  1. import java.applet.Applet;
  2. import java.applet.AppletStub;
  3. import java.awt.Dimension;
  4. import java.io.BufferedReader;
  5. import java.io.FileNotFoundException;
  6. import java.io.FileReader;
  7. import java.io.IOException;
  8. import java.net.MalformedURLException;
  9. import java.net.URL;
  10. import java.util.Properties;
  11.  
  12. import javax.swing.JDialog;
  13. import javax.swing.JFrame;
  14. import javax.swing.UIManager;
  15.  
  16. public class Loader extends Applet implements AppletStub {
  17.  
  18.     private static final long serialVersionUID = 1670498001014004354L;
  19.  
  20.     public static final boolean RSPS = true;
  21.  
  22.     public static Loader ctx;
  23.  
  24.     private Properties parameters = new Properties();
  25.  
  26.     public static JFrame clientFrame = null;
  27.  
  28.     public static boolean disableGameTips = true;
  29.  
  30.     public static final boolean LOCAL = true;
  31.  
  32.     public static final String HOST_ADDRESS = LOCAL ? "127.0.0.1" : "127.0.0.1";// "64.62.174.144";
  33.  
  34.     public static final int PORT = 43594;// LOCAL ? 43594 : 5555;
  35.  
  36.     public static void main(String... args) throws Exception {
  37.         Loader rsLoader = ctx = new Loader();
  38.         rsLoader.doFrame();
  39.     }
  40.  
  41.     private void doFrame() {
  42.         readParameters();
  43.         openFrame();
  44.         startClient();
  45.  
  46.         clientFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
  47.     }
  48.  
  49.     private void startClient() {
  50.         try {
  51.  
  52.             Class<?> client_class = Class.forName("client");
  53.  
  54.             Object v_client = client_class.getConstructor().newInstance();
  55.             client_class.getSuperclass().getMethod("supplyApplet", Applet.class).invoke(v_client, this);
  56.             client_class.getMethod("init").invoke(v_client);
  57.             client_class.getMethod("start").invoke(v_client);
  58.             client_class.getMethod("method5429").invoke(v_client);
  59.         } catch (Exception e) {
  60.             e.printStackTrace();
  61.         }
  62.     }
  63.  
  64.     public static void sendCS2Message(String text) {
  65.         Object[] params = new Object[] { 1211, text, 0, -120, 0 };
  66.         Class91.method1735(1486415494);
  67.         Class361_Sub39 class361_sub39 = new Class361_Sub39();
  68.         class361_sub39.cs2Arguments = params;
  69.         Class165.method2986(class361_sub39, (byte) 1);
  70.         // class39.aClass241_620 = null;
  71.     }
  72.  
  73.     private void openFrame() {
  74.         try {
  75.             UIManager.setLookAndFeel("org.jvnet.substance.skin.SubstanceRavenGraphiteLookAndFeel");
  76.         } catch (Exception e) {
  77.             e.printStackTrace();
  78.         }
  79.  
  80.         // ParticleSlider window = new ParticleSlider();
  81.         // window.particleSlider.setVisible(true);
  82.         // window.particleSlider.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
  83.         JFrame.setDefaultLookAndFeelDecorated(true);
  84.         JDialog.setDefaultLookAndFeelDecorated(true);
  85.         clientFrame = new JFrame("Nyx 751");
  86.         clientFrame.add(this);
  87.         clientFrame.setVisible(true);
  88.         clientFrame.setSize(800, 600);
  89.         clientFrame.setLocationRelativeTo(null);
  90.     }
  91.  
  92.     @SuppressWarnings("resource")
  93.     private void readParameters() {
  94.         try {
  95.             BufferedReader reader = new BufferedReader(new FileReader("./data/params.txt"));
  96.  
  97.             String line;
  98.             while ((line = reader.readLine()) != null) {
  99.                 if (line.contains("document.write('<param name=")) {
  100.                     String[] regex = line.split(" value=");
  101.  
  102.                     String parameterName = regex[0];
  103.                     String[] parameterRegex = parameterName.split("name=");
  104.                     String finalParameter = parameterRegex[1].replaceAll("\"", "");
  105.  
  106.                     String parameterValue = regex[1];
  107.                     String finalValue = parameterValue.replaceAll("\"", "").replace(">');", "");
  108.  
  109.                     if (RSPS && finalValue.startsWith("lobby")) {
  110.                         finalValue = HOST_ADDRESS;
  111.                     }
  112.                     parameters.put(finalParameter, finalValue);
  113.                 }
  114.             }
  115.         } catch (FileNotFoundException e) {
  116.             e.printStackTrace();
  117.         } catch (IOException e) {
  118.             e.printStackTrace();
  119.         }
  120.     }
  121.  
  122.     @Override
  123.     public void appletResize(int dimensionX, int dimensionY) {
  124.         super.resize(new Dimension(dimensionX, dimensionY));
  125.     }
  126.  
  127.     @Override
  128.     public String getParameter(String paramName) {
  129.         return (String) parameters.get(paramName);
  130.     }
  131.  
  132.     @Override
  133.     public URL getDocumentBase() {
  134.         try {
  135.             return new URL("http://" + HOST_ADDRESS);
  136.         } catch (MalformedURLException e) {
  137.             e.printStackTrace();
  138.         }
  139.         return null;
  140.     }
  141.  
  142.     @Override
  143.     public URL getCodeBase() {
  144.         return getDocumentBase();
  145.     }
  146. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement