// Decompiled by DJ v3.12.12.96 Copyright 2011 Atanas Neshkov  Date: 08/10/2012 8:47:16
// Home Page: http://members.fortunecity.com/neshkov/dj.html http://www.neshkov.com/dj.html - Check often for new version!
// Decompiler options: packimports(3) 
// Source File Name:   Applet1.java

package project;

import java.applet.Applet;
import java.io.BufferedInputStream;
import java.io.InputStream;
import java.net.*;
import org.xml.sax.InputSource;
import traduccion.Traducir;

// Referenced classes of package project:
//            MensajeDeError, ThreadInactividad, Crono, AccederADatos, 
//            EncriptarDesencriptar, Application1

public class Applet1 extends Applet
{

    public String getParameter(String key, String def)
    {
        return isStandalone ? System.getProperty(key, def) : getParameter(key) == null ? def : getParameter(key);
    }

    public static void main(String args[])
        throws Exception
    {
        Applet1 app = new Applet1();
        app.jbInit();
        Crono.losBotMeDejan(true);
    }

    public Applet1()
    {
        isStandalone = false;
    }

    public void init()
    {
        try
        {
            AccederADatos.entraComoApplet = true;
            AccederADatos.currentApplet = this;
            jbInit();
        }
        catch(Exception e)
        {
            e.printStackTrace();
        }
    }

    private void jbInit()
        throws Exception
    {
        if(AccederADatos.leer("h.demo").compareToIgnoreCase("No") == 0)
        {
            if(AccederADatos.leer("h.desencriptarModulos").compareToIgnoreCase("S\355") == 0)
                try
                {
                    URL proxyurl = new URL(AccederADatos.leer("h.proxyAddress") + "decriptData.jsp");
                    HttpURLConnection connection = (HttpURLConnection)proxyurl.openConnection();
                    connection.setRequestProperty("encriptar", AccederADatos.leer("h.encriptar"));
                    connection.connect();
                    BufferedInputStream bis = new BufferedInputStream(connection.getInputStream());
                    String textoEncriptado = EncriptarDesencriptar.getStringFromInputStream(bis);
                    String textoDesencriptado = EncriptarDesencriptar.desencriptar(textoEncriptado);
                    AccederADatos.decryptPassword = textoDesencriptado.trim();
                    InputSource stream = new InputSource(EncriptarDesencriptar.getInputStreamFromString(textoDesencriptado.trim()));
                    connection.getInputStream().close();
                }
                catch(Exception ex)
                {
                    ex.printStackTrace();
                    MensajeDeError mensaje = new MensajeDeError();
                    mensaje.mensaje(true, Traducir.getTraduccion(AccederADatos.leer("h.proyecto"), "project.Applet1", "200411151439", AccederADatos.idioma));
                    mensaje = null;
                }
        } else
        {
            AccederADatos.decryptPassword = "ESI";
        }
        Application1.primerosPasosARealizar();
        ThreadInactividad ti = new ThreadInactividad();
        ti.run();
    }

    public String getAppletInfo()
    {
        return "Applet Information";
    }

    public String[][] getParameterInfo()
    {
        return (String[][])null;
    }

    private boolean isStandalone;
}