/* Class661_Sub1 - Decompiled by JODE
 * Visit http://jode.sourceforge.net/
 */
import java.awt.Dimension;
import java.io.BufferedReader;
import java.io.File;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.lang.reflect.Method;
import java.net.InetSocketAddress;
import java.net.Proxy;
import java.net.ProxySelector;
import java.net.Socket;
import java.net.URI;
import java.net.URISyntaxException;
import java.net.URL;
import java.nio.charset.Charset;
import java.util.List;

public class Class661_Sub1 extends Class661
{
    ProxySelector aProxySelector10641 = ProxySelector.getDefault();
    static final String aString10642 = "java.net.useSystemProxies";
    
    public Socket method7890() throws IOException {
	boolean bool = (Boolean.parseBoolean
			(System.getProperty("java.net.useSystemProxies")));
	if (!bool)
	    System.setProperty("java.net.useSystemProxies", "true");
	boolean bool_0_ = 443 == ((Class661_Sub1) this).anInt8412 * 2048849985;
	List list;
	List list_1_;
	try {
	    list = (((Class661_Sub1) this).aProxySelector10641.select
		    (new URI(new StringBuilder().append
				 (bool_0_ ? "https" : "http").append
				 ("://").append
				 (((Class661_Sub1) this).aString8411)
				 .toString())));
	    list_1_ = (((Class661_Sub1) this).aProxySelector10641.select
		       (new URI(new StringBuilder().append
				    (bool_0_ ? "http" : "https").append
				    ("://").append
				    (((Class661_Sub1) this).aString8411)
				    .toString())));
	} catch (URISyntaxException urisyntaxexception) {
	    return method7886((byte) 22);
	}
	list.addAll(list_1_);
	Object[] objects = list.toArray();
	IOException_Sub1 ioexception_sub1 = null;
	Object[] objects_2_ = objects;
	for (int i = 0; i < objects_2_.length; i++) {
	    Object object = objects_2_[i];
	    Proxy proxy = (Proxy) object;
	    Socket socket;
	    try {
		Socket socket_3_ = method9940(proxy, (byte) 8);
		if (null == socket_3_)
		    continue;
		socket = socket_3_;
	    } catch (IOException_Sub1 ioexception_sub1_4_) {
		ioexception_sub1 = ioexception_sub1_4_;
		continue;
	    } catch (IOException ioexception) {
		continue;
	    }
	    return socket;
	}
	if (ioexception_sub1 != null)
	    throw ioexception_sub1;
	return method7886((byte) 64);
    }
    
    public Socket method7889(int i) throws IOException {
	boolean bool = (Boolean.parseBoolean
			(System.getProperty("java.net.useSystemProxies")));
	if (!bool)
	    System.setProperty("java.net.useSystemProxies", "true");
	boolean bool_5_ = 443 == ((Class661_Sub1) this).anInt8412 * 2048849985;
	List list;
	List list_6_;
	try {
	    list = (((Class661_Sub1) this).aProxySelector10641.select
		    (new URI(new StringBuilder().append
				 (bool_5_ ? "https" : "http").append
				 ("://").append
				 (((Class661_Sub1) this).aString8411)
				 .toString())));
	    list_6_ = (((Class661_Sub1) this).aProxySelector10641.select
		       (new URI(new StringBuilder().append
				    (bool_5_ ? "http" : "https").append
				    ("://").append
				    (((Class661_Sub1) this).aString8411)
				    .toString())));
	} catch (URISyntaxException urisyntaxexception) {
	    return method7886((byte) 120);
	}
	list.addAll(list_6_);
	Object[] objects = list.toArray();
	IOException_Sub1 ioexception_sub1 = null;
	Object[] objects_7_ = objects;
	for (int i_8_ = 0; i_8_ < objects_7_.length; i_8_++) {
	    Object object = objects_7_[i_8_];
	    Proxy proxy = (Proxy) object;
	    Socket socket;
	    try {
		Socket socket_9_ = method9940(proxy, (byte) 8);
		if (null == socket_9_)
		    continue;
		socket = socket_9_;
	    } catch (IOException_Sub1 ioexception_sub1_10_) {
		ioexception_sub1 = ioexception_sub1_10_;
		continue;
	    } catch (IOException ioexception) {
		continue;
	    }
	    return socket;
	}
	if (ioexception_sub1 != null)
	    throw ioexception_sub1;
	return method7886((byte) 83);
    }
    
    Socket method9940(Proxy proxy, byte i) throws IOException {
	if (proxy.type() == Proxy.Type.DIRECT)
	    return method7886((byte) 12);
	java.net.SocketAddress socketaddress = proxy.address();
	if (!(socketaddress instanceof InetSocketAddress))
	    return null;
	InetSocketAddress inetsocketaddress
	    = (InetSocketAddress) socketaddress;
	if (proxy.type() == Proxy.Type.HTTP) {
	    String string = null;
	    try {
		Class var_class
		    = (Class.forName
		       ("sun.net.www.protocol.http.AuthenticationInfo"));
		Method method
		    = var_class.getDeclaredMethod("getProxyAuth",
						  (new Class[]
						   { java.lang.String.class,
						     Integer.TYPE }));
		method.setAccessible(true);
		Object object
		    = method.invoke(null, (new Object[]
					   { inetsocketaddress.getHostName(),
					     new Integer(inetsocketaddress
							     .getPort()) }));
		if (null != object) {
		    Method method_11_
			= (var_class.getDeclaredMethod
			   ("supportsPreemptiveAuthorization", new Class[0]));
		    method_11_.setAccessible(true);
		    if (((Boolean) method_11_.invoke(object, new Object[0]))
			    .booleanValue()) {
			Method method_12_
			    = var_class.getDeclaredMethod("getHeaderName",
							  new Class[0]);
			method_12_.setAccessible(true);
			Method method_13_
			    = (var_class.getDeclaredMethod
			       ("getHeaderValue",
				new Class[] { java.net.URL.class,
					      java.lang.String.class }));
			method_13_.setAccessible(true);
			String string_14_
			    = ((String)
			       method_12_.invoke(object, new Object[0]));
			String string_15_
			    = ((String)
			       (method_13_.invoke
				(object, (new Object[]
					  { new URL(new StringBuilder().append
							("https://").append
							(((Class661_Sub1) this)
							 .aString8411)
							.append
							("/").toString()),
					    "https" }))));
			string = new StringBuilder().append(string_14_).append
				     (": ").append
				     (string_15_).toString();
		    }
		}
	    } catch (Exception exception) {
		/* empty */
	    }
	    return method9941(inetsocketaddress.getHostName(),
			      inetsocketaddress.getPort(), string,
			      -1807555044);
	}
	if (proxy.type() == Proxy.Type.SOCKS) {
	    Socket socket = new Socket(proxy);
	    socket.connect(new InetSocketAddress((((Class661_Sub1) this)
						  .aString8411),
						 (2048849985
						  * (((Class661_Sub1) this)
						     .anInt8412))));
	    return socket;
	}
	return null;
    }
    
    Socket method9941(String string, int i, String string_16_, int i_17_)
	throws IOException {
	Socket socket = new Socket(string, i);
	socket.setSoTimeout(10000);
	OutputStream outputstream = socket.getOutputStream();
	if (null == string_16_)
	    outputstream.write(new StringBuilder().append("CONNECT ").append
				   (((Class661_Sub1) this).aString8411).append
				   (":").append
				   (2048849985
				    * ((Class661_Sub1) this).anInt8412)
				   .append
				   (" HTTP/1.0\n\n").toString
				   ().getBytes(Charset.forName("ISO-8859-1")));
	else
	    outputstream.write(new StringBuilder().append("CONNECT ").append
				   (((Class661_Sub1) this).aString8411).append
				   (":").append
				   (2048849985
				    * ((Class661_Sub1) this).anInt8412)
				   .append
				   (" HTTP/1.0\n").append
				   (string_16_).append
				   ("\n\n").toString
				   ().getBytes(Charset.forName("ISO-8859-1")));
	outputstream.flush();
	BufferedReader bufferedreader
	    = new BufferedReader(new InputStreamReader(socket
							   .getInputStream()));
	String string_18_ = bufferedreader.readLine();
	if (string_18_ != null) {
	    if (string_18_.startsWith("HTTP/1.0 200")
		|| string_18_.startsWith("HTTP/1.1 200"))
		return socket;
	    if (string_18_.startsWith("HTTP/1.0 407")
		|| string_18_.startsWith("HTTP/1.1 407")) {
		int i_19_ = 0;
		String string_20_ = "proxy-authenticate: ";
		for (string_18_ = bufferedreader.readLine();
		     null != string_18_ && i_19_ < 50; i_19_++) {
		    if (string_18_.toLowerCase().startsWith(string_20_)) {
			string_18_
			    = string_18_.substring(string_20_.length()).trim();
			int i_21_ = string_18_.indexOf(' ');
			if (i_21_ != -1)
			    string_18_ = string_18_.substring(0, i_21_);
			throw new IOException_Sub1(string_18_);
		    }
		    string_18_ = bufferedreader.readLine();
		}
		throw new IOException_Sub1("");
	    }
	}
	outputstream.close();
	bufferedreader.close();
	socket.close();
	return null;
    }
    
    public Socket method7887() throws IOException {
	boolean bool = (Boolean.parseBoolean
			(System.getProperty("java.net.useSystemProxies")));
	if (!bool)
	    System.setProperty("java.net.useSystemProxies", "true");
	boolean bool_22_
	    = 443 == ((Class661_Sub1) this).anInt8412 * 2048849985;
	List list;
	List list_23_;
	try {
	    list = (((Class661_Sub1) this).aProxySelector10641.select
		    (new URI(new StringBuilder().append
				 (bool_22_ ? "https" : "http").append
				 ("://").append
				 (((Class661_Sub1) this).aString8411)
				 .toString())));
	    list_23_ = (((Class661_Sub1) this).aProxySelector10641.select
			(new URI(new StringBuilder().append
				     (bool_22_ ? "http" : "https").append
				     ("://").append
				     (((Class661_Sub1) this).aString8411)
				     .toString())));
	} catch (URISyntaxException urisyntaxexception) {
	    return method7886((byte) 108);
	}
	list.addAll(list_23_);
	Object[] objects = list.toArray();
	IOException_Sub1 ioexception_sub1 = null;
	Object[] objects_24_ = objects;
	for (int i = 0; i < objects_24_.length; i++) {
	    Object object = objects_24_[i];
	    Proxy proxy = (Proxy) object;
	    Socket socket;
	    try {
		Socket socket_25_ = method9940(proxy, (byte) 8);
		if (null == socket_25_)
		    continue;
		socket = socket_25_;
	    } catch (IOException_Sub1 ioexception_sub1_26_) {
		ioexception_sub1 = ioexception_sub1_26_;
		continue;
	    } catch (IOException ioexception) {
		continue;
	    }
	    return socket;
	}
	if (ioexception_sub1 != null)
	    throw ioexception_sub1;
	return method7886((byte) 12);
    }
    
    public Socket method7888() throws IOException {
	boolean bool = (Boolean.parseBoolean
			(System.getProperty("java.net.useSystemProxies")));
	if (!bool)
	    System.setProperty("java.net.useSystemProxies", "true");
	boolean bool_27_
	    = 443 == ((Class661_Sub1) this).anInt8412 * 2048849985;
	List list;
	List list_28_;
	try {
	    list = (((Class661_Sub1) this).aProxySelector10641.select
		    (new URI(new StringBuilder().append
				 (bool_27_ ? "https" : "http").append
				 ("://").append
				 (((Class661_Sub1) this).aString8411)
				 .toString())));
	    list_28_ = (((Class661_Sub1) this).aProxySelector10641.select
			(new URI(new StringBuilder().append
				     (bool_27_ ? "http" : "https").append
				     ("://").append
				     (((Class661_Sub1) this).aString8411)
				     .toString())));
	} catch (URISyntaxException urisyntaxexception) {
	    return method7886((byte) 100);
	}
	list.addAll(list_28_);
	Object[] objects = list.toArray();
	IOException_Sub1 ioexception_sub1 = null;
	Object[] objects_29_ = objects;
	for (int i = 0; i < objects_29_.length; i++) {
	    Object object = objects_29_[i];
	    Proxy proxy = (Proxy) object;
	    Socket socket;
	    try {
		Socket socket_30_ = method9940(proxy, (byte) 8);
		if (null == socket_30_)
		    continue;
		socket = socket_30_;
	    } catch (IOException_Sub1 ioexception_sub1_31_) {
		ioexception_sub1 = ioexception_sub1_31_;
		continue;
	    } catch (IOException ioexception) {
		continue;
	    }
	    return socket;
	}
	if (ioexception_sub1 != null)
	    throw ioexception_sub1;
	return method7886((byte) 54);
    }
    
    Class661_Sub1() {
	/* empty */
    }
    
    public Socket method7885() throws IOException {
	boolean bool = (Boolean.parseBoolean
			(System.getProperty("java.net.useSystemProxies")));
	if (!bool)
	    System.setProperty("java.net.useSystemProxies", "true");
	boolean bool_32_
	    = 443 == ((Class661_Sub1) this).anInt8412 * 2048849985;
	List list;
	List list_33_;
	try {
	    list = (((Class661_Sub1) this).aProxySelector10641.select
		    (new URI(new StringBuilder().append
				 (bool_32_ ? "https" : "http").append
				 ("://").append
				 (((Class661_Sub1) this).aString8411)
				 .toString())));
	    list_33_ = (((Class661_Sub1) this).aProxySelector10641.select
			(new URI(new StringBuilder().append
				     (bool_32_ ? "http" : "https").append
				     ("://").append
				     (((Class661_Sub1) this).aString8411)
				     .toString())));
	} catch (URISyntaxException urisyntaxexception) {
	    return method7886((byte) 93);
	}
	list.addAll(list_33_);
	Object[] objects = list.toArray();
	IOException_Sub1 ioexception_sub1 = null;
	Object[] objects_34_ = objects;
	for (int i = 0; i < objects_34_.length; i++) {
	    Object object = objects_34_[i];
	    Proxy proxy = (Proxy) object;
	    Socket socket;
	    try {
		Socket socket_35_ = method9940(proxy, (byte) 8);
		if (null == socket_35_)
		    continue;
		socket = socket_35_;
	    } catch (IOException_Sub1 ioexception_sub1_36_) {
		ioexception_sub1 = ioexception_sub1_36_;
		continue;
	    } catch (IOException ioexception) {
		continue;
	    }
	    return socket;
	}
	if (ioexception_sub1 != null)
	    throw ioexception_sub1;
	return method7886((byte) 12);
    }
    
    static void method9942(int i) {
	if (Class463.aClass151_5283.method2342()) {
	    Class463.aClass151_5283.method2188(Class630.aCanvas8127,
					       1145729374);
	    Class205.method3010(436582683);
	    Dimension dimension = Class630.aCanvas8127.getSize();
	    Class463.aClass151_5283.method2275(Class630.aCanvas8127,
					       dimension.width,
					       dimension.height, 771308027);
	    Class463.aClass151_5283.method2012(Class630.aCanvas8127,
					       287391614);
	} else
	    Class539.method6593(Class447.aClass487_Sub42_5156
				    .aClass637_Sub8_10521.method9667((byte) 1),
				false, 2097393816);
	Class613.method7433(-758145146);
    }
    
    public static boolean method9943(int i) {
	if (Class470.aString5331.startsWith("win")) {
	    String string = "msvcr110.dll";
	    String string_37_ = "msvcp110.dll";
	    String[] strings = { string, string_37_ };
	    String string_38_ = System.getenv("WINDIR");
	    if (string_38_ == "")
		return false;
	    for (int i_39_ = 0; i_39_ < strings.length; i_39_++) {
		File file
		    = new File(new StringBuilder().append(string_38_).append
				   ("\\system32\\").append
				   (strings[i_39_]).toString());
		if (!file.exists() || file.isDirectory())
		    return false;
	    }
	    return true;
	}
	if (Class470.aString5331.startsWith("mac")) {
	    boolean bool;
	    try {
		Process process = Runtime.getRuntime().exec("ps -few");
		BufferedReader bufferedreader
		    = (new BufferedReader
		       (new InputStreamReader(process.getInputStream())));
		do {
		    boolean bool_40_;
		    try {
			int i_41_ = process.waitFor();
			if (0 == i_41_)
			    break;
			bool_40_ = false;
		    } catch (InterruptedException interruptedexception) {
			return false;
		    }
		    return bool_40_;
		} while (false);
		boolean bool_42_ = false;
	    while_54_:
		do {
		    String string;
		    do {
			if ((string = bufferedreader.readLine()) == null)
			    break while_54_;
		    } while (string.toLowerCase().indexOf("soundflowerbed")
			     == -1);
		    bool_42_ = true;
		} while (false);
		bufferedreader.close();
		bool = bool_42_;
	    } catch (Exception exception) {
		return false;
	    }
	    return bool;
	}
	return false;
    }
    
    public static final int method9944(int i) {
	return (int) (1000000000L
		      / (Class473.aLong5383 * 8599743404253538185L));
    }
    
    static final void method9945(Class612 class612, int i) {
	Class625 class625 = (((Class612) class612).aBool8038
			     ? ((Class612) class612).aClass625_8045
			     : ((Class612) class612).aClass625_8029);
	Class211 class211 = ((Class625) class625).aClass211_8099;
	Class203 class203 = ((Class625) class625).aClass203_8100;
	Class504.method6250(class211, class203, false, 1, class612, 341396336);
    }
}
